{"id":42,"date":"2023-05-10T15:29:10","date_gmt":"2023-05-10T15:29:10","guid":{"rendered":"http:\/\/18.139.116.96\/?p=42"},"modified":"2023-09-19T12:51:01","modified_gmt":"2023-09-19T04:51:01","slug":"aws-blog-post-2","status":"publish","type":"post","link":"http:\/\/blogs.zurien.com\/?p=42","title":{"rendered":"AWS Auto Scaling Group (ASG)"},"content":{"rendered":"\n<p>In our previous AWS networking blog, we already created Elastic load balancer (ELB), now we want to automate the creation of Target instance using Auto Scaling Group (ASG). <\/p>\n\n\n\n<p>Creating ASG has 2 phases. First, you need to create Launch Template where we define EC2 instance as well as Security Groups. The 2nd phase is where you create Auto Scaling Group as associate the the Launch Template you create. Below is the step by guide in creating both phases.<\/p>\n\n\n\n<p>Creating Launch Template<\/p>\n\n\n\n<ol>\n<li>On the left pane, Click <strong>Lunch Templates<\/strong> under Instances<\/li>\n\n\n\n<li>On the main pane, click <strong>Create launch template<\/strong><\/li>\n\n\n\n<li>Assign a launch template name and add description.<\/li>\n\n\n\n<li>Enable <strong>Provide guidance to help me set up a template that I can use with EC2 Auto Scaling<\/strong><\/li>\n\n\n\n<li>Under Application and OS Image, click <strong>Browse more AMIs<\/strong>. This will take you to a page where you can select which image\/OS that will be installed in your EC2 instances.<\/li>\n\n\n\n<li>Select radio button next to the 1st option <strong>Amazon Linux 2 AMI (HVM) &#8211; Kernel 5.10<\/strong> for simplicity sake. Click <strong>Select<\/strong><\/li>\n\n\n\n<li>Under Instance type, select <strong>t3.micro<\/strong><\/li>\n\n\n\n<li>Under Key pair, select <strong>Don&#8217;t include in launch template<\/strong><\/li>\n\n\n\n<li>Under Security Group, select the same Security Group you created or selected in your ELB (Refer to the ELB Blog Post).<\/li>\n\n\n\n<li>On the Advanced Settings, under IAM Instance Profile, select the existing Instance Profile.<\/li>\n\n\n\n<li>Under User data, add a custom shell script. This will run when the instance starts and the script installs the application required dependencies and launch the application.<\/li>\n\n\n\n<li>Finally, click <strong>Create launch template<\/strong> located on the buttom right of the page.<\/li>\n\n\n\n<li>Click <strong>View launch template<\/strong> to verify if template has been created.<\/li>\n<\/ol>\n\n\n\n<p>Creating Auto Scaling Group (ASG)<\/p>\n\n\n\n<ol>\n<li>On the left page, click Auto <strong>Scaling Group <\/strong>under <strong>Auto Scaling<\/strong><\/li>\n\n\n\n<li>Click <strong>Create Auto Scaling group<\/strong> located on the upper right of the page. <\/li>\n\n\n\n<li>Assign preferred Auto scaling group name.<\/li>\n\n\n\n<li>Select the Lauch template name you created from previous task.<\/li>\n\n\n\n<li>Verify if details matches such as AMI ID, Security Group, Instance type etc.<\/li>\n\n\n\n<li>Click <strong>Next<\/strong>, this will take you to the Network configuration page of your Auto Scaling Group.<\/li>\n\n\n\n<li>Select the correct VPC and Availability Zone (Refer to the ELB Blog Post) . Click <strong>Next<\/strong><\/li>\n\n\n\n<li> Select <strong>Attach to an existing load balancer <\/strong>and select the target group name you created (Refer to the ELB Blog Post).<\/li>\n\n\n\n<li>Under <strong>Health checks<\/strong>, select <strong>ELB <\/strong>to inherit the health check settings of your ELB. Click <strong>Next<\/strong>.<\/li>\n\n\n\n<li>Under <strong>Group size<\/strong>, Enter value of <strong>2<\/strong> for <strong>Desired<\/strong>, <strong>2<\/strong> for <strong>Minimum Capacity<\/strong> and <strong>4<\/strong> for <strong>Maximum Capacity<\/strong>.<\/li>\n\n\n\n<li>Under <strong>Scaling Policies<\/strong>, Select <strong>Average CPU Utilization<\/strong>, Enter a value of <strong>40<\/strong> for <strong>Target Value<\/strong>. Click <strong>Next<\/strong>.<\/li>\n\n\n\n<li>We will now activate Notifications by clicking <strong>Add Notifications<\/strong>. Click <strong>Create Topic<\/strong>.<\/li>\n\n\n\n<li>Assign a topic name and make sure to add recipient email address as alarms\/notifications will be sent to the email address you entered.<\/li>\n\n\n\n<li>Click <strong>Next<\/strong>, click <strong>Next<\/strong> as we will not be configuring Tags. <\/li>\n\n\n\n<li>Review Auto Scaling Group configuration and click <strong>Create Auto Scaling Group<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p><strong>Click below to access the video version and consider subscribing<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"AWS Networking - Auto Scaling Group (ASG) Part 2\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/Xdv6k0XiVbk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In our previous AWS networking blog, we already created Elastic load balancer (ELB), now we want to automate the creation of Target instance using Auto Scaling Group (ASG). Creating ASG has 2 phases. First, you need to create Launch Template where we define EC2 instance as well as Security Groups. The 2nd phase is where [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":227,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[3],"jetpack_featured_media_url":"http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg","rttpg_featured_image_url":{"full":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg",1080,608,false],"landscape":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg",1080,608,false],"portraits":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg",1080,608,false],"thumbnail":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2-150x150.jpg",150,150,true],"medium":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2-300x169.jpg",300,169,true],"large":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2-1024x576.jpg",800,450,true],"1536x1536":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg",1080,608,false],"2048x2048":["http:\/\/blogs.zurien.com\/wp-content\/uploads\/2023\/05\/AWS-Networking-Auto-Scaling-Group-ASG-Part-2-thumbnail2.jpg",1080,608,false]},"rttpg_author":{"display_name":"user","author_link":"http:\/\/blogs.zurien.com\/?author=1"},"rttpg_comment":1,"rttpg_category":"<a href=\"http:\/\/blogs.zurien.com\/?cat=1\" rel=\"category\">Uncategorized<\/a>","rttpg_excerpt":"In our previous AWS networking blog, we already created Elastic load balancer (ELB), now we want to automate the creation of Target instance using Auto Scaling Group (ASG). Creating ASG has 2 phases. First, you need to create Launch Template where we define EC2 instance as well as Security Groups. The 2nd phase is where&hellip;","_links":{"self":[{"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/posts\/42"}],"collection":[{"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=42"}],"version-history":[{"count":17,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":997,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/posts\/42\/revisions\/997"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=\/wp\/v2\/media\/227"}],"wp:attachment":[{"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blogs.zurien.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}