0 votes
in Amazon Elastic Compute Cloud EC2 by

EC2 CLI Commands

Let's check some useful CLI Commands that are used with respect to EC2.

  1. Launching an instance t2.micro in EC2-VPC:
aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-xxxxxxxx.
  1. Launching an instance in EC2-classic:
aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t1.micro --key-name MyKeyPair --security-groups my-sg
  1. Tagging an instance:
aws ec2 create-tags --resources i-xxxxxxxx --tags Key=Name,Value=MyInstance

4 . Terminating an instance :

aws ec2 terminate-instances --instance-ids i-5203422c

Related questions

0 votes
asked May 26, 2020 in Amazon Elastic Compute Cloud EC2 by Indian
+1 vote
asked May 22, 2020 in Amazon Elastic Compute Cloud EC2 by Indian
...