Amazon EC2 Container Service and Elastic Beanstalk: Docker on AWS
Technology keeps moving. In just a few years, we've gone from servers running on dedicated hardware, through virtualization, and then cloud computi...Learn More
Have you ever launched an EC2 instance with Amazon EBS (Elastic Block Store) storage only to realize that your EBS storage is way over-allocated and you have no idea on how to reduce it?
Amazon’s Elastic Block Store Volumes are easy to use and expanding them is no problem at all, but for some reason, there’s no obvious way to reduce them. This is especially problematic when the EBS volume is mounted on the root.
It turns out that there’s nothing to worry about. I’ll take you through an easy way to reduce your volumes so you can hopefully save yourself some money.
For the purpose of this exercise, I created an instance and launched it with a 20GB Amazon EBS volume:
Assuming we want to reduce this to 8GB, the first thing we will need to do is to make a note of the root volume’s block device name and our instance’s availability zone
So in my case, the details are
Block Device Name = /dev/sda1
Availability Zone = ap-southeast-2b
Using the snapshot, create a second volume – of the original size – in the same availability zone as your instance.
Hopefully, you will have something like this:
Now, attach both volumes to the instance and again note all device name details.
Block Device Name Big Volume = /dev/sda1
Block Device Name Big Volume Snapshot = /dev/sdg
Block Device Name Small Volume = /dev/sdf
ssh -i <Private-key> ec2-user@ip-address
Create a file system for the 2 volumes you have created (Note: In Ubuntu I had to do a cat/proc/partitions to work out which device was which).
sudo mkfs -t ext4 /dev/xvdf sudo mkfs -t ext4 /dev/xvdg
Create two mount directories and mount the new volumes.
sudo mkdir /mnt/small sudo mount /dev/xvdf /mnt/small sudo mkdir /mnt/snap sudo mount /dev/xvdg1 /mnt/snap
Sync the files.
sudo rsync -aHAXxSP /mnt/snap/ /mnt/small
Unmount the smaller volume.
sudo umount /dev/xvdf
Detach all volumes.
Attach the small volume to the Block Device Name from the first step.
Block Device Name = /dev/sda1
Now you can restart your instance and verify that it is working correctly.
I recommend taking a look at Cloud Academy’s Managing Instance Volumes Using EBS Hands-on Lab if you want to learn to create an EC2 instance with an additional EBS volume.
IMPORTANT Don’t forget to delete your snapshot and the two other volumes that are no longer needed. That can save you some big bucks.
July has been a very exciting month for us at Cloud Academy. On July 10, we officially joined forces with QA, the UK’s largest B2B skills provider (read the announcement). Over the coming weeks, you will see additions from QA’s massive catalog of 500+ certification courses and 1500+ ins...
If you are just starting out on your journey toward mastering AWS cloud computing, then your first stop should be to understand the AWS fundamentals. This will enable you to get a solid foundation to then expand your knowledge across the entire AWS service catalog. It can be both d...
The DevOps Handbook introduces DevOps as a framework for improving the process for converting a business hypothesis into a technology-enabled service that delivers value to the customer. This process is called the value stream. Accelerate finds that applying DevOps principles of flow, f...
The speed at which machine learning (ML) is evolving within the cloud industry is exponentially growing, and public cloud providers such as AWS are releasing more and more services and feature updates to run in parallel with the trend and demand of this technology within organizations t...
AWS re:Inforce 2019 is a two-day conference for security, identity, and compliance learning and community building. This year's keynote, presented by AWS Vice President and CIO, Stephen Schmidt, announced the general availability of AWS Control Tower and the new VPC Traffic Mirroring fe...
Being able to architect your own isolated segment of AWS is a simple process using VPCs; understanding how to architect its related networking components and connectivity architecture is key to making it a powerful service. Many services within Amazon Web Services (AWS) require you t...
AWS is renowned for the rate at which it reinvents, revolutionizes, and meets customer demands and expectations through its continuous cycle of feature and service updates. With hundreds of updates a month, it can be difficult to stay on top of all the changes made available. Here ...
Amazon Web Services (AWS) offers three different ways to pay for EC2 Instances: On-Demand, Reserved Instances, and Spot Instances. This article will focus on effective strategies for purchasing Reserved Instances. While most of the major cloud platforms offer pre-pay and reservation dis...
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 11 certifications that cover major cloud roles including Solutions Architect, De...
The AWS Solutions Architect - Associate Certification (or Sol Arch Associate for short) offers some clear benefits: Increases marketability to employers Provides solid credentials in a growing industry (with projected growth of as much as 70 percent in five years) Market anal...
Moving data to the cloud is one of the cornerstones of any cloud migration. Apache NiFi is an open source tool that enables you to easily move and process data using a graphical user interface (GUI). In this blog post, we will examine a simple way to move data to the cloud using NiFi c...
Amazon DynamoDB is a managed NoSQL service with strong consistency and predictable performance that shields users from the complexities of manual setup. Whether or not you've actually used a NoSQL data store yourself, it's probably a good idea to make sure you fully understand the key ...