3 Ways to speed up your EC2 instances boot time
Let's say you're running your application in an EC2 instance. The application requires a specific set of framework or runtimes to be installed to run. It also needs a few scripts to be run on the instance for configuring the application.
Things are going good in a single EC2 instance.
Now you want to scale up your application (EC2) instances so that they can handle peak loads.
You setup an auto scaling group to scale up the instance count when required.
But you notice that setting up the application runtime each time a new instance is launched is taking up a lot of time.
Also you need to figure out how to install the configuration scripts for every new instance launched.
So how do we do it?
1️⃣ Use a Golden AMI
A Golden AMI is a custom AMI with required application, libraries, pre installed. You can simply choose a Golden AMI that has your application stack pre-installed and use it as your instance AMI.
2️⃣ EC2 User data
EC2 User data is an optional space where you can provide scripts. These scripts are run when the instance is first launched. You can use this to run your dynamic configuration data scripts.
3️⃣ EBS Snapshot
An EBS is a network attached storage that your instance uses as it’s virtual hard drive.
You can simply create a snapshot of the EBS volume that the single EC2 instance has been using and then create new volumes from it for all your new instances.
That means ready made data available from the snapshot as the instance starts.
These are the 3 best ways you can employ to speed up your instance boot time. As your instances boot faster, you can scale up faster!
Subscribe to my newsletter — https://referbruv.substack.com/