How to launch EC2 instance with default vpc

·

1 min read

aws ec2 run-instances --image-id ami-0c94855ba95c71c99 --count 1 --instance-type t2.micro --key-name my-key-pair --security-group-ids sg-12345678 --associate-public-ip-address

In this example command:

  • Ami-0c94855ba95c71c99 is the ID of the Amazon Machine Image (AMI) you want to use to launch the instance.

  • 1 is the number of instances you want to launch.

  • t2.micro is the instance type you want to use.

  • my-key-pair is the name of the key pair you want to use to connect to the instance.

  • sg-12345678 is the ID of the security group you want to use for the instance.

  • --associate-public-ip-address is used to assign a public IP address to the instance.

/