
Explore deploying containerized applications on AWS using Terraform and Fargate. Learn to build an auto scaling, highly available, fault tolerant deployment platform with ECS.
Set up an AWS account with free tier; leverage VPC and EKS; use Terraform with Visual Studio Code or IntelliJ to build infrastructure as code for ECS, Fargate, spring microservices.
Install the AWS CLI on Linux using apt-get, configure credentials, and verify with aws --help.
Configure the AWS CLI by entering your access key, secret key, and a default region. Set the output format to json, and prepare your environment for Terraform deployments.
Install Docker on Windows 10 professional or enterprise 64-bit by choosing Docker Desktop for Windows or Docker Toolbox, then enable virtualization in BIOS to run VirtualBox and complete setup.
Install TerraForm on macOS using homebrew, upgrade to the latest version, test the installation, then install the TerraForm plugin in IntelliJ with HashiCorp TerraForm language support.
Install the AWS CLI on macOS using Homebrew to configure access keys and secret keys for command-line access to AWS resources; cover pip and package installation options and test setup.
Create a Terraform project in the ecs_fargate directory, add main.tf and variables.tf, and set up the workspace for deploying Fargate ECS apps. Open the project in IntelliJ and start development.
Define the Terraform remote state backend for the infrastructure layer. Create infrastructure-prod.config and configure the x-fargate-terraform-remote-state bucket in eu-west-1 to enable backend state sharing.
Create a production VPC on AWS using Terraform, define region and cidr block as variables, set an S3 backend, enable DNS hostnames, and tag the VPC.
Create private subnets in AWS using Terraform, defining CIDR blocks, availability zones (EU West 1A, 1B, 1C), and names for three subnets, with plans to add route tables.
Create a public route table in AWS with Terraform, naming it public-route-table and tagging it as public route table, then preview the upcoming private route table video.
Associate public and private subnets with route tables using Terraform, referencing route table IDs and subnet IDs for multiple subnets, and outline elastic IP, NAT gateway, and internet gateway.
Create an elastic ip for a nat gateway in your vpc to enable private subnet egress to the internet for updates and content without inbound access.
Create a nat gateway using an elastic ip, attach it to a public subnet, and link it to a private route table with a 0.0.0.0/0 route to access the internet.
Create an internet gateway in your production VPC and add a public route to the public route table, enabling resources to access the internet via Terraform.
Create an AWS ECS cluster using Terraform by defining an AWS ECS cluster resource and naming it production Fargate cluster.
Create an internet-facing application load balancer for an ECS cluster with Terraform, configure its security group, and reference VPC and subnets from remote state.
Create an AWS ACM domain certificate and validate it via DNS for your ECS cluster load balancer. Use Terraform in domain.tf with Route 53 records and wildcard domain support.
Create a default ECS target group for the application load balancer; route traffic to subdomains, name it with the cluster and TGW suffix, set port 80 http, and tag.
Create an IAM role for the ECS cluster to access AWS services such as S3 and autoscaling, and configure an inline JSON assume-role policy in Terraform.
Create and attach an inline IAM policy to the ECS cluster role, granting access to EC2, ECR, CloudWatch, S3, and other services via a JSON policy.
Execute terraform to provision a multi-layer AWS platform and output remote state values like VPC ID, VPC CIDR, EKS cluster, ALB listener, domain name, and subnets, then apply the plan.
Deploy a simple Spring Boot application to AWS Fargate, focusing on the infrastructure surrounding the app, including server port configuration and health and metrics endpoints, built with Maven.
Configure a Terraform backend on AWS S3 with remote state, set up the AWS provider and region variables, and prepare ECS service task definitions for the spring boot app.
Create an ecs task definition for a spring boot app on fargate using a json template with placeholders, including image, env vars, port mappings, and cloudwatch log settings.
Read a task definition JSON as a Terraform template, render it with variables like memory, docker image URL, and spring profile, then create an ECS task definition for AWS Fargate.
Create and configure a security group for the ECS service on Fargate with Terraform, linking the VPC, defining ingress for the Spring Boot app, and allowing outbound internet access.
Create an AWS ALB target group for a Fargate ECS service using Terraform, specifying the container port, IP target type, HTTP health checks at /actuator/health, and health thresholds.
Create an aws alb listener rule in terraform to forward traffic from the load balancer to the ecs target group, using a host header to build a service subdomain.
Create a CloudWatch log group with Terraform using the AWS log group resource, naming it after the service plus a log group suffix; AWS will create log streams automatically.
Review and refine the application infrastructure for a spring boot app on Fargate ECS, including task definition rendering, AWS provider, S3 backend, and execution role fixes, before execution.
Learn to implement production-ready infrastructure with AWS ECS Fargate container platform using Terraform today with an AWS Certified Solutions Architect!
Do you want to implement your complete infrastructure as code? Do you want to learn the coolest and most popular infrastructure configuration management tool on the market, Terraform and make a huge contribution to your skillset?
Then this course is what you need! You will not only learn how to implement Terraform code but also implement an AWS Well-Architected Framework recommended deployment model which will be Highly-Available, Scalable, Fault-Tolerant and Resilient!
In this course, we will start by exploring the tools we need throughout the course. Just to note here too, we will need an IDE with a proper Terraform plugin available. An AWS account is also necessary so I will show you how to get one if you do not already have it. Sure we will set up our environment variables for Terraform deployments and also configure our IDE to use Terraform efficiently by installing a Terraform Plugin which will highlight the syntax and auto-complete everything we intend to do.
In between all these, I will also give you a crash course on Terraform where you will gain all the information you need to implement this infrastructure!
Once we have everything set up, now is time to get our hands dirty and write some Terraform code to implement our cool, shiny architecture!
We will start off with implementing our remote state and obtaining a key pair which we will use to connect to the instances we will launch. Once we get these done, we will first create the Virtual Private Cloud (VPC) environment. To meet the demands of high-availability, we will spread our private and public subnets to three different availability zones inside a region. We will also create our Private and Public Route Tables to manage the routing between our resources inside VPC.
We’ll also make sure to attach an Internet Gateway (IGW) to our VPC to use with public subnets so the resources in those will be able to access and receive public internet traffic. Our private subnet also need some form of internet connection but not both ways; we want only internet access for outgoing connections from our resources in private subnets! To satisfy this requirement, we will launch and attach a NAT Gateway to our private route table.
Now is the time to develop our AWS ECS platform! To start with, we will first register ourselves a domain which we will use for our Spring Boot application. Then we will create an ECS cluster, Target Group, Application Load Balancer, HTTPS Listener and Certificate and IAM roles for ECS cluster to prepare for application deployment.
Next up is to check out the Spring Boot application that we will deploy to AWS ECS Fargate! We will take a quick look and start by implementing our ECS Fargate Task Definition. We will move on to create our IAM Role and Policy, ECS Service, Target Group, Listener Rule and CloudWatch Log Group to finish up with getting ready to deploy our application!
In the next chapter, we will script the whole pipeline of our application from building with Maven to pushing Docker image to AWS Elastic Container Registry (ECR) and then to deploying to AWS ECS Fargate! We will create ourselves a shell-script to implement everything as a different stage and develop the whole pipeline!
Once we're satisfied with the pipeline, we'll start executing our stages one by one! We'll first build the code, build and push our Docker image to AWS ECR and finally we will deploy our Spring Boot application to AWS ECS Fargate to have it up and running with our registered domain!
There are much more to come in this course and I cannot wait for you to come and learn the best practices from an AWS Certified Solutions Architect!