Small Tip: Use AWS CLI to create instances with bigger root partitions

2014/06/05 AWS, DevOps, Small Tip 2 comments , , , , ,

On multiple occasions we had to deal with instances running out of disk space for the root file system. AWS provides you reasonable amount of storage, but most operating systems without additional settings will just use the root partition for everything. Which is usually sub-optimal, since default root partition is 8GB and you may have 160GB SSD just mounted on /mnt and never used. With the AWS Web interface, it is easy. Just create bigger root partitions for the instances. However, the AWS CLI solution is not obvious and somewhat hard to find. If you need to regularly start instances with non-standard root partitions, manual approach is not maintainable.

There is a solution. It lies in the –block-device-mappings parameter that can be passed to aws ec2 run-instances command.

According to the documentation this parameter uses JSON-encoded block device mapping to adjust different parameter of the instances that are being started. There is a simple example that shows how to attach additional volume:

This will attach additional 100GB EBS volume as /dev/sdb. The key part: “Ebs”: {“VolumeSize”: 100}

By specifying your instance’s root partition you can adjust the root partition size. Following is an example how to create Amazon Linux instance running on t1.micro with 32GB root partition:

The resulting volume details show the requested size and the fact that this is indeed root partition:
Screen Shot 2014-06-05 at 4.30.31 PM

Confirming, that the instance is operating on the proper volume:

There is enough space in the root partition now. Note: This is EBS volume, additional charges will apply!


  • aws ec2 run-instances help

Small Tip: AWS tools are case sensitive, AWS Web Interface is not

2014/06/02 AWS, DevOps, Small Tip No comments , , , , , , ,

In a recent investigation, we found an interesting difference between AWS command line tools (based on Boto library) and AWS Web interface. Apparently, command line tools are case sensitive while AWS Web interface is not. This can potentially lead to automated scaling issues. Tooling may not get ‘the full picture’ if tags are mixed-case and software does not account for that.

Lets start with simple example …

We have the following EC2 instances in AWS Account:
Screen Shot 2014-06-02 at 10.03.04 AM

Search for the term ‘TEST-NODE’ yields the same results as searching for ‘test-node’ in the AWS Web interface.

Searching for ‘TEST-NODE':
Screen Shot 2014-06-02 at 10.03.27 AM

Searching for ‘test-node':
Screen Shot 2014-06-02 at 10.03.49 AM

… it behaves the same way. It is case-insensitive.

However, commend line tools will produce totally different output.

Searching for ‘TEST-NODE':

Searching for ‘test-node':

Python + Boto shows the same behavior (not surprisingly, AWS CLI uses Boto):

Searching for ‘TEST-NODE':

Searching for ‘test-node':


There are multiple possible solutions to this issue. With the cost of few extra cycles one can make sure proper comparison is implemented: