quinta-feira, 25 de junho de 2015

Setup AWS cli to access your account [for a Linux/Mac client]

This short recipe shows how to setup your Access Key to view, change and manage your AWS resources.

1) You need to get your access keys. When you create a new account you have the option to generate an Access Key to the new user on creation. Take in mind that after generation the key is displayed only ONCE. You CANNOT recover a secret key, for obvious security reasons.

Best practice hint: NEVER use the Access keys from the root account (the Mail you used to create your AWS account), create an IAM account to manage all AWS resources.

2) After you have your Access Key ID and Secret Acess Key we can move forward.

3) Here we will cover the most simple way to setup your credentials, for a detailed overview, please check the document link in the end of this tech recipe.

If you have only one account you may type only

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
Replace the red options with your settings, the region you use the most and the output format, for the output we have 3 options: json, text or table, default is json.

You must specify the AWS Access Key ID, the Secret Access Key and the Region. For a list of regions and endpoints, please refer to this document: http://docs.aws.amazon.com/general/latest/gr/rande.html

If you have multiple AWS customers or IAM accounts you can define different profiles for each of these.
$ aws configure --profile TEST-ENVIRONMENT
AWS Access Key ID [None]: AKIAI44QH8DHBEXAMPLE
AWS Secret Access Key [None]: je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY
Default region name [None]: us-east-1
Default output format [None]: text
4) Test if your configured account is working: And you are done! Now it is time to explore the AWS CLI documentation and see what you can do with it.
$ aws ec2 describe-volumes --profile TEST-ENVIRONMENT
5. Further reading:
http://docs.aws.amazon.com/cli/latest/userguide/tutorial-ec2-ubuntu.html#configure-cli-launch-ec2 http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html

Nenhum comentário:

Postar um comentário