{"id":4497,"date":"2025-05-03T16:25:22","date_gmt":"2025-05-03T16:25:22","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4497"},"modified":"2025-05-03T16:25:23","modified_gmt":"2025-05-03T16:25:23","slug":"example-website-workload-aws-elastic-container-service-aws-with-alb-route53-and-certificate","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4497","title":{"rendered":"Example Website Workload &#8211; AWS Elastic Container Service (AWS) with ALB, Route53 and Certificate"},"content":{"rendered":"\n<p>The below gives a simple example showing how you can deploy a containerised workload: a NGINX web server in this example which has two (or more) containers (tasks) running on AWS Fargate, presented behind a &#8220;Service&#8221; definition which is then presented to the Internet via an Application Load Balancer (ALB) where a certificate is obtained and added to the ALB, and AWS Route53 is used to create the DNS record automatically to point at the ALB.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"971\" height=\"434\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/05\/image.png\" alt=\"\" class=\"wp-image-4498\" srcset=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/05\/image.png 971w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/05\/image-300x134.png 300w, https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2025\/05\/image-768x343.png 768w\" sizes=\"auto, (max-width: 971px) 100vw, 971px\" \/><\/figure>\n\n\n\n<p>The example offers limited customisation, deploys the EU-WEST-2&nbsp;<strong>Region&nbsp;<\/strong>(London) with two subnets in different&nbsp;<strong>Availability Zones<\/strong>: EU-WEST-2A and EU-WEST-2B.<\/p>\n\n\n\n<p>The example uses the domain&nbsp;<strong>tristanself.co.uk<\/strong>, which has its nameservers running within AWS Route53, allowing records to be added, changed and removed programatically. However you may substitute in your own domain name as required, however you must ensure that have obtained the AWS Route53 Hosted Zone ID first, which along with the domain name needs to be entered into the&nbsp;<strong>variables.tf<\/strong>&nbsp;file.<\/p>\n\n\n\n<p>The example uses a local Terraform state storage, however you may easily swap this to use remote state, see the documentation\u00a0<a href=\"https:\/\/geekmungus.co.uk\/?p=4120\">https:\/\/geekmungus.co.uk\/?p=4120<\/a> if you require it.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExampleWebsiteWorkloadAWSElasticContainerService(AWS)withALB,Route53andCertificate-Repository\">Repository<\/h1>\n\n\n\n<p>The example Terraform definitions can be found within Gitlab:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/tristanhself\/general\/tree\/master\/aws\/ecs-alb-dns\">https:\/\/github.com\/tristanhself\/general\/tree\/master\/aws\/ecs-alb-dns<\/a><\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"ExampleWebsiteWorkloadAWSElasticContainerService(AWS)withALB,Route53andCertificate-Deployment\">Deployment<\/h1>\n\n\n\n<p>Once you have cloned the repository, you need to update the following variables within the variables.tf file:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>route53zone &#8211; Add the AWS Route53 Hosted Zone ID you wish to use with your application.<\/li>\n\n\n\n<li>domainname &#8211; Add the domain name (excluding subdomains) which you wish to use for your application. The Terraform definition adds a\u00a0<a href=\"http:\/\/www.domainname.com\/\">www.domainname.com<\/a>\u00a0record for you automatically.<\/li>\n<\/ul>\n\n\n\n<p>The deployment can then be completed with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform apply &#91;--auto-approve]<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The below gives a simple example showing how you can deploy a containerised workload: a NGINX web server in this example which has two (or more) containers (tasks) running on AWS Fargate, presented behind a &#8220;Service&#8221; definition which is then presented to the Internet via an Application Load Balancer (ALB) where a certificate is obtained &#8230; <a title=\"Example Website Workload &#8211; AWS Elastic Container Service (AWS) with ALB, Route53 and Certificate\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4497\" aria-label=\"Read more about Example Website Workload &#8211; AWS Elastic Container Service (AWS) with ALB, Route53 and Certificate\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4496,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,46],"tags":[],"class_list":["post-4497","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","category-docker"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4497"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4497\/revisions"}],"predecessor-version":[{"id":4499,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4497\/revisions\/4499"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4496"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}