Це стара версія документу!
AWS Profile
Є два основних варіанти підключення AWS профілю:
IAM User через Access Key / Secret Key
AWS SSO ( IAM Identity Center )
1. AWS Profile через Access Key / Secret Key
=== Необхідні дані: ===
- AWS Access Key ID
- AWS Secret Access Key
- AWS Region
Приклад:
Access Key ID: AKIAxxxxxxxx Secret Access Key: xxxxxxxxx Region: eu-west-3
==== Створення профілю ====
''aws configure --profile PROFILE_NAME''
Приклад:
''aws configure --profile prod''
Ввести:
AWS Access Key ID: AWS Secret Access Key: Default region name: Default output format:
Приклад:
AWS Access Key ID: AKIAxxxxxxx AWS Secret Access Key: xxxxxxx Default region name: eu-west-3 Default output format: json
==== Перевірка ====
''aws sts get-caller-identity --profile prod''
Успішна відповідь:
''{
"UserId": "XXXXXXXX",
"Account": "123456789",
"Arn": "arn:aws:iam::123456789:user/user"
}''
2. AWS Profile через SSO
==== Необхідні дані: ====
- SSO Start URL
- SSO Region
- AWS Account
- Role / Permission Set
- Default AWS Region
Приклад:
SSO URL: https:////company.awsapps.com/start// SSO Region: eu-central-1 Region: eu-west-3 Role: Developer
==== Створення SSO профілю ====
''aws configure sso --profile PROFILE_NAME''
Приклад:
''aws configure sso --profile prod''
Ввести:
SSO session name: SSO start URL: SSO region:
Приклад:
SSO session name: prod SSO start URL: https:////company.awsapps.com/start// SSO region: eu-central-1
Після цього відкриється браузер:
AWS Sign In
Потрібно авторизуватись.
Далі вибрати:
AWS Account Role Default region Output format
Приклад:
Default region: eu-west-3 Output format: json
==== Вхід через SSO ====
''aws sso login --profile prod''
==== Перевірка ====
''aws sts get-caller-identity --profile prod''
Успішна відповідь:
''{
"Account": "123456789",
"Arn": "arn:aws:sts::123456789:assumed-role/Developer/user"
}''
Корисні команди
==== Показати всі профілі ====
''aws configure list-profiles'' </file> ---- ==== **Подивитись налаштування профілю** ==== <code>''aws configure list --profile prod'' </file> ---- ==== **Де зберігаються профілі** ==== Основний конфіг: <code>''~/.aws/config''
Access keys:
''~/.aws/credentials''
SSO токени:
''~/.aws/sso/cache/''
==== Використання профілю ====
Вказати явно:
''aws COMMAND --profile prod'' </file> або зробити профіль за замовчуванням: Linux/macOS: <code>''export AWS_PROFILE=prod''
Windows PowerShell:
''$env:AWS_PROFILE="prod"''