AWS Command line Tasks : Create EC2 instance and EC2 instance with 500GB root volume.

To create an EC2 instance from command line.

aws ec2 run-instances  --image-id ami-efe09bf8 --count 1 --instance-type m4.4xlarge --key-name mysshkey --security-group-ids sg-126adasd2--subnet-id subnet-148fd971 --block-device-mapping /dev/sda1=:500:false --region us-east-1

--image-id : The AMI ID which we are going to create the instance.
--count : The number of instances that we need to create.
--instance-type : The type of EC2 instance that we are going to use it.
--key-name : The pem that we are going to use to connect to this server.
--secrutiy group : The security group this instance is getting used.
--subnet-id : The subnet in which we want the ec2 instance.
--block device mapping - device:space in gb : to terminate volume [true or false.]

To create an EC2 instance with 500GB root volume.

aws ec2 run-instances --image-id ami-efe09bf8 --block-device-mappings  '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":500,"DeleteOnTermination":false}}]' --count 1 --instance-type m4.4xlarge --key-name mysshkey --security-group-ids sg-126adasd2 --subnet-id subnet-148fd971 --region us-east-1


Comments

Popular posts from this blog

Logical volume vmxxxx_img is used by another device - Error on LVM removal

Open VZ cheat Sheet

Cheat sheet for Hardware RAID health check - Megaraid, Adaptec, 3wareraid and HPraid.