Post

AWS - AWS CLI commands

AWS CLI commands


see the account number and your user ID:

1
2
3
4
5
6
7
$ aws sts get-caller-identity
{
    "Account": "533078679665",
    "UserId": "AROAXYHPXEBY7QBCBKPP2:user762073=lgraceye@hotmail.com",
    "Arn": "arn:aws:sts::533078679665:assumed-role/voclabs/user762073=lg
raceye@hotmail.com"
}

have any EC2 instances running in the sandbox, running this command would provide information about them:

1
2
3
4
$ aws ec2 describe-instances
{
    "Reservations": []
}

Using the AWS SDK for Python

The terminal also has Python 3 installed with the boto 3 library available.

to run AWS Python SDK code

1
2
3
4
5
6
$ python3
>>> import boto3
>>> ec2 = boto3.client('ec2', region_name='us-east-1')
>>> ec2.describe_regions()
>>> exit()
$

.

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.