Last active
February 15, 2020 10:26
-
-
Save josephphyo/c97cc0887ada602a76c322716bd0600f to your computer and use it in GitHub Desktop.
AWS Cli Usage - Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<< Key Pair >> | |
Create a Key Pair | |
$ aws ec2 create-key-pair --key-name MyKeyPair --query 'KeyMaterial' --output text > MyKeyPair.pem | |
$ chmod 400 MyKeyPair.pem | |
Display Key Pair | |
$ aws ec2 describe-key-pairs --key-name MyKeyPair | |
Delete Key Pair | |
$ aws ec2 delete-key-pair --key-name MyKeyPair | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
<< Security Group >> | |
Create Security Group | |
$ aws ec2 create-security-group --group-name sg-name --description "Ec2 security group" --vpc-id your-vpc-id | |
Verify created security group | |
$ aws ec2 describe-security-groups --group-ids sg-123456g8 | |
Delete Security Group | |
$ aws ec2 delete-security-group --group-id sg-123456g8 | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
<< Ec2 >> | |
Launch Ec2 Instance | |
$ aws ec2 run-instances --image-id ami-id --count 1 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-123456g8 --subnet-id subnet-6e7f829e | |
Tagging | |
$ $ aws ec2 create-tags --resources i-5203422c --tags Key=Name,Value=MyInstance | |
Listing Ec2 Instance | |
$ aws ec2 describe-instances --filters "Name=tag:Name,Values=MyInstance" | |
Terminate Instance | |
$ aws ec2 terminate-instances --instance-ids i-5203422c | |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws iam create-virtual-mfa-device --virtual-mfa-device-name IAMUSERNAME --outfile /home/ec2-user/MFA-QRCode.png --bootstrap-method QRCodePNG | |
aws iam enable-mfa-device --user-name IAMUSERNAME --serial-number arn:aws:iam::ACCOUNTID:mfa/IAMUSERNAME --authentication-code-1 123456 --authentication-code-2 789123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment