{"id":3647,"date":"2023-02-11T02:50:27","date_gmt":"2023-02-11T02:50:27","guid":{"rendered":"https:\/\/exceedthecloud.com\/?p=3647"},"modified":"2023-02-11T02:47:26","modified_gmt":"2023-02-11T02:47:26","slug":"application-load-balancer-alb-hands-on-with-aws-ec2-instances","status":"publish","type":"post","link":"https:\/\/exceedthecloud.com\/?p=3647","title":{"rendered":"Application Load Balancer (ALB) Hands on with AWS EC2 instances"},"content":{"rendered":"\n<p>Choose an Application Load Balancer when you need a flexible feature set for your applications with HTTP and HTTPS traffic. Operating at the request level, Application Load Balancers provide advanced routing and visibility features targeted at application architectures, including microservices and containers.<\/p>\n\n\n\n<p>Prerequisite: Having a valid AWS Account (Follow the step in this link to create an AWS Account) <a href=\"https:\/\/exceedthecloud.com\/?p=3419\" target=\"_blank\" rel=\"noreferrer noopener\">How to Sign Up for a new Amazon Web Services Account<\/a><\/p>\n\n\n\n<p>Open the page: <a href=\"https:\/\/aws.amazon.com\/account\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/aws.amazon.com\/account\/<\/a><\/p>\n\n\n\n<p>To complete this lab, create two EC2 instances in different Availability zone<\/p>\n\n\n\n<p>Launch instance with User data to update and configure service httpd<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"471\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture1-9.png\" alt=\"\" class=\"wp-image-3648\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture1-9.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture1-9-300x226.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Find bellow the content of User data<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# Use this for your user data (script from top to bottom)\n# install httpd (Linux 2 version)\nyum update -y\nyum install -y httpd\nsystemctl start httpd\nsystemctl enable httpd\necho \"&lt;h1&gt;Hello World from $(hostname -f)&lt;\/h1&gt;\" &gt; \/var\/www\/html\/index.html\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"473\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture2-9.png\" alt=\"\" class=\"wp-image-3649\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture2-9.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture2-9-300x227.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Confirm the creation of the 2 instances<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"91\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture3-9.png\" alt=\"\" class=\"wp-image-3650\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture3-9.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture3-9-300x44.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>First server instance<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"251\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture4-9.png\" alt=\"\" class=\"wp-image-3651\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture4-9.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture4-9-300x121.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Second server instance<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"266\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture5-8.png\" alt=\"\" class=\"wp-image-3652\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture5-8.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture5-8-300x128.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Create an application load balancer<\/p>\n\n\n\n<p>Click in the menu \u2013 Load Balancers<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"422\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture6-8.png\" alt=\"\" class=\"wp-image-3653\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture6-8.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture6-8-300x203.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Click on create load balancer<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"127\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture7-8.png\" alt=\"\" class=\"wp-image-3654\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture7-8.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture7-8-300x61.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Choose Application Load balancer \/ Click on Create<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"573\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture8-7.png\" alt=\"\" class=\"wp-image-3655\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture8-7.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture8-7-300x275.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Enter the name of the Load Balancer \/ Choose Internet facing<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"423\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture9-7.png\" alt=\"\" class=\"wp-image-3656\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture9-7.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture9-7-300x203.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Choose at least two Availability Zone and one subnet per zone<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"533\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture10-7.png\" alt=\"\" class=\"wp-image-3657\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture10-7.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture10-7-300x256.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Create a new Security Group to allow only port 80<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"301\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture11-7.png\" alt=\"\" class=\"wp-image-3658\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture11-7.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture11-7-300x145.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Create a target group \/ Click on Create target group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"422\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture12-5.png\" alt=\"\" class=\"wp-image-3659\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture12-5.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture12-5-300x203.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Enter the Target Group name \/ Protocol version and health checks<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"849\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture13-4.png\" alt=\"\" class=\"wp-image-3660\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture13-4.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture13-4-220x300.png 220w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Choose Available instances to register the target instances \/ Click on Create target group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"292\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture14-6.png\" alt=\"\" class=\"wp-image-3661\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture14-6.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture14-6-300x140.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Confirm the creation of the Target group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"267\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture15-4.png\" alt=\"\" class=\"wp-image-3662\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture15-4.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture15-4-300x128.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Go back and choose the newly created Target Group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"438\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture16-3.png\" alt=\"\" class=\"wp-image-3663\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture16-3.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture16-3-300x211.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Validate the summary and click on Create load balancer<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"342\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture17-3.png\" alt=\"\" class=\"wp-image-3664\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture17-3.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture17-3-300x164.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Confirm the creation of your load balancer<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"202\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture18-2.png\" alt=\"\" class=\"wp-image-3665\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture18-2.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture18-2-300x97.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"288\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture19-1.png\" alt=\"\" class=\"wp-image-3666\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture19-1.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture19-1-300x138.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Copy the load balancer url in a web browser to confirm you have access to your web application<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"216\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture20-1.png\" alt=\"\" class=\"wp-image-3667\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture20-1.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture20-1-300x104.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Stop one instance and validate you still have access to your web application<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"89\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture21-1.png\" alt=\"\" class=\"wp-image-3668\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture21-1.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture21-1-300x43.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>View the health status of your target group<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"270\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture22-1.png\" alt=\"\" class=\"wp-image-3669\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture22-1.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture22-1-300x130.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Confirm you still have access to your web application via the URL of your load balancer<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"243\" src=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture23-1.png\" alt=\"\" class=\"wp-image-3670\" srcset=\"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture23-1.png 624w, https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/Picture23-1-300x117.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p>Credit: <a href=\"https:\/\/www.udemy.com\/user\/stephane-maarek\/\" target=\"_blank\" rel=\"noreferrer noopener\">Stephane Maarek<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Choose an Application Load Balancer when you need a flexible feature set for your applications with HTTP and HTTPS traffic. Operating at the request level, Application Load Balancers provide advanced routing and visibility features targeted at application architectures, including microservices &hellip; <a href=\"https:\/\/exceedthecloud.com\/?p=3647\">Continued<\/a><\/p>\n","protected":false},"author":1,"featured_media":3671,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"kt_blocks_editor_width":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[121,118,123],"tags":[119,120,130,29],"class_list":["post-3647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-amazon-web-services","category-aws","category-aws-basics","tag-aws","tag-aws-account","tag-ec2","tag-load-balancer"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/exceedthecloud.com\/wp-content\/uploads\/2023\/02\/alb.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/3647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3647"}],"version-history":[{"count":5,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/3647\/revisions"}],"predecessor-version":[{"id":3708,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/posts\/3647\/revisions\/3708"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=\/wp\/v2\/media\/3671"}],"wp:attachment":[{"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/exceedthecloud.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}