Check out my new course Learn you some Lambda best practice for great good! and learn the best practices for performance, cost, security, resilience, observability and scalability.
An EBS volume can range from 1GB to 1TB and can be mounted to an Amazon EC2 instance as a device, each EBS volume can be mounted to one instance but multiple volumes can be mounted to the same instance. To mount an EBS volume to an instance you have to first log into the AWS Management Console and follow a few simple steps.
Creating a new volume
1. Once inside the AWS Management Console, click the Volumes link under Elastic Block Store in the Navigation panel:
2. Click the ‘Create Volume‘ button:
3. In the pop-up form, choose the size of the EBS volume you want to create and select the availability zone (remember, the EBS volume needs to be in the same availability zone as the instance it needs to be attached to):
Click “Create” to create a new EBS volume.
Attaching an EBS Volume to an Instance
1. Once the EBS volume is created and its status changed to ‘available’, select it, and click the “Attach Volume” button:
2. In the following pop-up, choose the instance you want to attach the volume:
Mount the EBS Volume as a drive
1. Now that the EBS volume is attached to the instance, remote connect to the instance, go to Start –> Run, and enter “diskmgmt.msc” to start the Disk Management tool:
2. In the Disk Management tool, right click on the new disk, which is “Offline” right now and bring it “Online“:
3. The disk then needs to be initialized, right click again and select “Initialize Disk“:
4. Choose whether to initialize the disk with MBR or GPT:
5. You’re almost there! Right click on the unallocated space in the initialized disk and create a “New Simple Volume“:
and follow the steps in the wizard.
6. A 10GB volume will probably take 5 ~ 10 mins to format, and once it’s done you’ll be able to see the drive:
As mentioned in Membase’s documentation here, when using an Amazon EC2 instance as a Membase cache server you can use an EBS volume to alleviate the risk of losing your data when an instance fails because the EBS volume can be attached to another instance to effectively restore the node.
Another fun fact about EBS and Amazon EC2 is that Windows 2008 instances are backed and run directly from an EBS volume because of the sheer size of the images themselves! Which is why for every Windows Server 2008 instance you are running you’ll find a 30GB EBS volume attached to that instance, and every AMI you create will have a matching EBS snapshot. And the implication of this is that, if you’re using a Windows instance to run Membase, you won’t need to create additional EBS volumes to store the Membase sqlite files. BUT, there’s a catch, if you terminate the instance manually or through a scaling down event the EBS volume will be deleted too, so be sure to take this into consideration when deriving your strategy for deploying and scaling your Membase cache clusters.
I specialise in rapidly transitioning teams to serverless and building production-ready services on AWS.
Are you struggling with serverless or need guidance on best practices? Do you want someone to review your architecture and help you avoid costly mistakes down the line? Whatever the case, I’m here to help.
Check out my new course, Learn you some Lambda best practice for great good! In this course, you will learn best practices for working with AWS Lambda in terms of performance, cost, security, scalability, resilience and observability. Enrol now and enjoy a special preorder price of £9.99 (~$13).
Are you working with Serverless and looking for expert training to level-up your skills? Or are you looking for a solid foundation to start from? Look no further, register for my Production-Ready Serverless workshop to learn how to build production-grade Serverless applications!
Here is a complete list of all my posts on serverless and AWS Lambda. In the meantime, here are a few of my most popular blog posts.
- Lambda optimization tip – enable HTTP keep-alive
- You are thinking about serverless costs all wrong
- Many faced threats to Serverless security
- We can do better than percentile latencies
- I’m afraid you’re thinking about AWS Lambda cold starts all wrong
- Yubl’s road to Serverless
- AWS Lambda – should you have few monolithic functions or many single-purposed functions?
- AWS Lambda – compare coldstart time with different languages, memory and code sizes
- Guys, we’re doing pagination wrong