Skip to main content

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


Popular posts from this blog

Qmail cheat sheet

1) To check the mail queue in plesk from command line, you can use the command :


2) You can examine the queue with qmail-qread.


3) From the qread command you get the message id . In the above example , let us assume one of the id is 524514 . Now you can find the file holding the email in/var/qmail/queue with find command.

# find /var/qmail/queue -iname 524514


/var/qmail/queue/mess/22/524514 (mail headers)


4) From the mail header you get the IP address

vi /var/qmail/queue/mess/22/524514


Shortcut for the cool guys

find /var/qmail/queue -iname queu_id | grep mess | xargs less


4) If you wish …

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

Hi Folks,

I've faced error while trying to remove an LVM from the server.

The exact LVM error will be "Logical volume vmxxxx_img is used by another device" on executing the lvremove command.

Feel free to remove the following steps to remove the LVM from the server.

Note: Please remember to replace <id> with your VMID in the below section.

dmsetup ls dmsetup info -c xen-vm<id>_img dmsetup remove xen-vm<id>_img lvremove -f /dev/xen/vm<id>_img ----------------------------------------------------------

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

Hi Folks,

In another post "raid type" I've mentioned how to find if the server is running with Software or Hardware RAID.

Here, we can go ahead and check the health of the Hardware RAID array in the server.

The first thing we need to detect is the controller in which the raid is configured and you can easily get it from the another post that I mentioned earlier. However, I'm providing it here again for your convenience.

1. Login to the server as the root user.
2. Execute the following command.

/sbin/lspci -vv | grep -i raid

3. This will show the raid controller running on the server. The different types of controller I've worked with includes

a. Megaraid which uses megacli
b. Adaptec which uses arcconf.
c. 3ware raid which uses tw_cli
d. HPraid which uses hpacucli.

How to check the Megaraid array health status?

The Megaraid is usually installed in the /opt/MegaRAID and you can execute the following command to verify the health of the array.