ACCESSING AMAZON RESOURCES VIA CLI / Command

ACCESSING AMAZON RESOURCES VIA CLI / Command

Requirement
1. Download
https://aws.amazon.com/cli/
Once its installed we can go to command prompt and confirm the same by running command aws –version

cli1

2. Post installation of the package we need to download the access keys (Access key ID , Secret key)
3. Just login to amazon console https://aws.amazon.com/console/ go to top right and click on the account name as shown under below screenshot and click the menu My Security Credentials

cli2

4. Next Click on the option Access Keys and then Download Keys as shown below

cli3

5. Post clicking the the Download Key file keys will be downloaded in CSV format save it under a secure place
6. Next we need to configure aws on CLI on command prompt just need to enter command
aws configure we need to use the Key Generated in previous step for configuration purpose.

aws configure
> AWS Access Key ID [None]: AKIAIOSDNN7EXAMPLE
> AWS Secret Access Key [None]: XUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
> Default region name [None]: us-west-2
> Default output format [None]: ENTER

7. Once above command completed successfully we can further start using respective EC2 commands to manage the EC2 resources accordingly
8. Also before using the command we need to make sure we have set the region to correct location
Few of the commonly used commands

Command to start a EC2 instance
• aws ec2 start-instances –instance-ids i-1234567890abcdef0
Command to stop a EC2 instance
• aws ec2 stop-instances –instance-ids i-1234567890abcdef0

2. Post installation of the package we need to download the access keys (Access key ID , Secret key)
3. Just login to amazon console https://aws.amazon.com/console/ go to top right and click on the account name as shown under below screenshot and click the menu My Security Credentials

4. Next Click on the option Access Keys and then Download Keys as shown below
uj

5. Post clicking the the Download Key file keys will be downloaded in CSV format save it under a secure place
6. Next we need to configure aws on CLI on command prompt just need to enter command
aws configure we need to use the Key Generated in previous step for configuration purpose.

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]: ENTER

7. Once above command completed successfully we can further start using respective EC2 commands to manage the EC2 resources accordingly
8. Also before using the command we need to make sure we have set the region to correct location

Few of the commonly used commands

Command to start a EC2 instance
• aws ec2 start-instances –instance-ids i-1234567890abcdef0
Command to stop a EC2 instance
• aws ec2 stop-instances –instance-ids i-1234567890abcdef0

Leave a Reply