For CLI
we need python-pip
pip install awscli
We need to use configure by using aws-configure
command
aws configure - to configure access key in ec2
S3
aws s3 ls s3://mybucket
aws s3 cp myfolder s3://mybucket/folder --recursive
aws s3 sync myfolder s3://mybucket/folder --exclude
*.tmp
aws s3 mb s3://mybucket
aws s3 rb s3://bucket-name
aws s3 rb s3://bucket-name --force
The sync command has the following form. Possible
source-target combinations are:
Local file system to Amazon S3
Amazon S3 to local file system
Amazon S3 to Amazon S3
However, you may supply the --delete option to remove
files or objects from the target not present in the source.
EC2
aws ec2 describe-instances - Each instance detail
with start with keyword reservations
aws ec2 describe-vpcs
aws ec2 describe-subnets
aws ec2 run-instances
aws ec2 describe-instances
aws ec2 start-instances --instance-ids i-12345678c
aws ec2 create-instances
1) To create
snapshot from command line
aws ec2 create-snapshot --region $region --description
$ec2_snapshot_description --volume-id $ebs_selected --output text --query
SnapshotId 2>&1
volume id - is the id for the respective ebs volume
2) Create New IAM role
$aws iam create-instance-profile --instance-profile-name YourNewRole-Instance-Profile
$aws iam add-role-to-instance-profile --role-name YourNewRole --instance-profile-name YourNewRole-Instance-Profile
$aws ec2 associate-iam-instance-profile --instance-id YourInstanceId --iam-instance-profile Name=YourNewRole-Instance-Profile
$aws ec2 describe-iam-instance-profile-associations
4) Replace existing IAM role
$aws ec2 replace-iam-instance-profile-association
--association-id YourCurrentAssociation-id --iam-instance-profile
Name=YourReplacementRole-Instance-Profile