How to choose the deployment strategy in AWS?

Saad Hasan
4 min readNov 1, 2022

--

In AWS deployment services, several deployment methods can be chosen to serve your needs. This depends on many factors like speed, the applicable downtime for your application, cost, and the desired capacity while deploying to not affect the performance and availabilities and other factors.

This article will provide an overview of deployment strategies that can be used in your deployment.

First thing first, we have to talk about Prebaking and Bootstrapping AMI’s.

Bootstrapping AMI

An Amazon Machine Image (AMI) is a supported and maintained image provided by AWS that provides the information required to launch an instance(1).

Information like operating system type, amount of storage volumes required, permissions and software packages, etc. The process of installing your application and the dependencies when you lunch an EC2 instance is called bootstrapping an instance. Note that, If you have large dependencies that need to be installed, this can slow down your deployment and autoscaling of your events as well. Hence, you have to think twice while designing the deployment service to do fast rollouts/rollbacks to take advantage of Auto Scaling Group ( ASG).

Prebaking AMI

Let say you have Nodejs application that need Nginx for the frontend , and Elasticsearch for logs base , and Dynamodb for the database. To prepare an AMI for that setup at everytime we need to lunch instance it will be a nightmare activity , right ? In prebaking AMI you can choose to install most of application dependencies, package and artifacts during the bootstrapping process of the instance and alter the installation based on configuration sets grouped by instance tags, Auto Scaling groups, or other instance artifacts. for instance, you can tag the Nginx image with a certain vergion to be used in the prebaked AMI images.

So, prebaking is the process of embedding a significant portion of your application artifacts and within your base AMI. In case of Auto Scaling and you need to scale-up your instance and deploy it with customized Nginx tags ( eg. tags with vergion
njs-0.7.8
) or by instance metadata or instance Scaling groups.

Deployment strategies

Blue/Green Deployments

This method the most used strategy for deployment. As the it’s name indicate , we have two separate and identical environments , the current environment (blue) which has the current application version let say app_v1, and one environment (green) with the new application vergion app_v2. Once the deployment in the green environment is done, the Application Load Blancer or by doing a CNAME swap can split the traffic between the two environments ( e.g. 10% to app_v2 and 90% to app_v1). This will minimize the deployment risk and we can rollback easlly to Blue environment with zero downtime. Once testing has been completed on the green environment, live application traffic is directed to the green environment and the blue environment is deprecated.

Blue/green deployment type

Rolling Deployments

Unlike Blue/Green deployment , this strategy has isolation between old and new application version. The fleet of instances are divided into portions and it deploy the new application version into portion of instance not all-at-once. This will insure the two application version will run simultaneously with no downtime and in case of the deployment failures , only the new instances will be affected.

Rolling deployment type

In-Place (All at once) Deployments

This’s the fastest deployment strategy and all the resources with old app version will be stopped and the latest app version with be installed all-at-once in all resources without need to change on environment infrastructure components. once the deployment is done , the new app version will be evaluated and tested. This allows application deployments to proceed with minimal disturbance to underlying infrastructure.

Everything has cost , and the cost for fast deployment is the downtime. The availability of your application can be affected during these deployments. However, on the other hand , this approach also minimizes infrastructure costs and management overhead associated with creating new resources.

In-Place Deployments

Compare Deployment strategies

Summarizes the characteristics

Conclusion

The needs of your application determine which is the best approach to choose. AWS provide many tools to simplify and automate the provisioning infrastructure redeployment and application deployment method. You can also combine the deployment service with third-part deployment services which will help you or your company to easily integrate your existing CI/CD pipeline with AWS deployment services.

--

--

Saad Hasan
Saad Hasan

Written by Saad Hasan

AWS Cloud Engineer ، Kafka Admin , OpenShift , I write about cloud knowledge.