Description: In this previous blog, we'll walk through setting up a In-placed standalone EC2 instance deployment. In this blog we are going to design Deployment strategy for an Angular application hosted
on Amazon EC2 instances with auto-scaling and load balancer with in-placed and blue green deployment
Step-1 Setup AMI image for auto-scaling
First step is to setup image for the auto-scaling, So we are going to use same machine, as we have setup in previous blog for standalone deployment.
In the existing machine I am going to remove all the content from the webroot [/var/www/my-angular]
After cleaning the web-root directory, create the AMI image from the AWS console
Fill the details and click on create
Once image created and available in image list
Step2: Setup Auto-scaling Group and Launch template
Navigate to Auto-Scaling Group --> Create Auto Scaling Group
Create launch template, select the image which we have created. Also define instance type, key and security group.
Once all the details filled click on create launch template, it shows the output as follow
Select the launch template from the list
select vpc and subnets
Create load balancer and attached it to auto-scaling group. Load balancer is internet-facing
Define the scaling capacity as I have defined as follow
min: 2
Desired:2
max: 3
Review and create the auto-scaling group
We forgot to add IAM role, So create new version of template and add it
after create the version edit in template and change it
Step3: Create application and deployment group with auto-scaling
Navigate to CodeDeploy -->Deploy --> Application --> Create Application
After create application, create the deployment group
Fill all require details
Select the load balancer and click on create deployment group
Step4: Change the deployment group in pipeline
Save the pipeline and Release change. After completion of pipeline you get the result
Browse the load balancer url, you will get the output
Step5: Deploy application using Bule-green deployment
For blue-green deployment create application
Create deployment group for blue-green
Set environment configuration
Change Deployment Settings and create deployment group
Once the deployment group created, Edit it deployment stage and change it to blue-green deployment and save it
After change release the change it We can get the list of additional instance in deployment
After instance update, the new instance replacement
Once all the thing validate we can terminate the old instance
No comments:
Post a Comment