Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 5

AWS –CLI Installation

pip install awscli ( Linux )

Install the AWS CLI Using Python and pip on Windows

Download the Python Windows x86-64 installer from the Python.org


Choose Add Python to PATH.
Choose Install Now.

To install the AWS CLI with pip


pip –version
pip install awscli

To check aws-cli installed


Aws –version

Next command to check path is added or not


Open Cmd –type - where aws ( if command written with path information ok, if not we need to
add path to environment variable )
AWS-CLI Installation Cont..
To modify your PATH variable (Windows)

Press the Windows key and enter environment


variables.
Choose Edit environment variables for your account.
Choose PATH, and then choose Edit.
Add the path to the Variable value field. For
example: C:\new\path
Choose OK twice to apply the new settings.
Close any running command prompts and reopen the
command prompt window.
Working with AWS CLI
Describe instance
aws ec2 describe-instances --instance-ids i-0cc59c7094954c90e
aws ec2 describe-instances --filters "Name=instance-type,Values=m1.small“
aws ec2 describe-instances --filters "Name=tag-key,Values=Owner“

To create key pair


aws ec2 create-key-pair --key-name 'my key pair‘

To check Spot price


aws ec2 describe-spot-price-history --max-items 5

To create new instance


aws ec2 run-instances --image-id ami-0889b8a448de4fc44 --count 1 --instance-type t2.micro --key-
name yum --security-group-ids sg-88a41ae4 --subnet-id subnet-e652d3aa

To Tag instance
aws ec2 create-tags --resources i-0178b021c3de73267 --tags Key=Name,Value=MyInstance

Terminate instance
aws ec2 terminate-instances --instance-ids i-0178b021c3de73267
Working with AWS CLI
Working with S3

To Create bucket
aws s3 mb s3://bucket-name

To list your bucket


aws s3 ls

To list all the objects in the buckets


aws s3 ls s3://bucket-name

To delete bucket force


aws s3 rb s3://bucket-name –force

Working with IAM

To create group
aws iam create-group --group-name MyIamGroup

To create user
aws iam create-user --user-name MyUser
Working with AWS CLI
To create access key
aws iam create-access-key --user-name MyUser

To add user to group


aws iam add-user-to-group --user-name MyUser --group-name MyIamGroup

To verfify user added to group


aws iam get-group --group-name MyIamGroup

To attach policy
aws iam attach-user-policy --user-name MyUser --policy-arn policyarn

To check which policy attach


aws iam list-attached-user-policies --user-name MyUser

To set initial password


aws iam create-login-profile --user-name MyUser --password My!User1Login8P@ssword --
password-reset-required

You might also like