먼저 credentials 에서 user 의 access key id 와 secret key 를 입력하고
~/.aws/credentials
config 파일에서 region 을 선택해주면 해당 region 을 이용가능하다.~/.aws/config
사용은 아래와 같이 하면 된다.내경우는 서울과 도쿄의 리전을 프로파일을 만들어 아래와 같이 리전 값드를 불러오거나 생성할 때 사용하니 편리한것 같다.
aws ec2 describe-instances --profile seoul
aws ec2 describe-instances --profile tokyo
aws ec2 describe-instances --profile oregon
각 리전의 security 그룹복사를 할수 없어 해당 스크립트들을 만들어서 사용하니 편함..
아래는 AWS 공식 가이드이다. 참고하길.Named Profiles
The AWS CLI supports named profiles stored in the config and credentials files. You can configure additional profiles by using
aws configure
with the --profile
option or by adding entries to the config and credentials files.
The following example shows a credentials file with two profiles:
~/.aws/credentials
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
[user2]
aws_access_key_id=AKIAI44QH8DHBEXAMPLE
aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
Each profile uses different credentials—perhaps from two different IAM users—and can also use different regions and output formats.
~/.aws/config
[default]
region=us-west-2
output=json
[profile user2]
region=us-east-1
output=text
Important
The AWS credentials file uses a different naming format than the CLI config file for named profiles. Do not include the 'profile ' prefix when configuring a named profile in the AWS credentials file.
Using Profiles with the AWS CLI
To use a named profile, add the
--profile
option to your command. The following example lists running instances using the user2
profile from the previous section.$ aws ec2 describe-instances --profile user2