Microservices CI/CD With AWS + Terraform: Click Here To Watch Video Tutorial
Microservices CI/CD With AWS + Terraform: Click Here To Watch Video Tutorial
Microservices CI/CD
With
AWS + Terraform
What is Microservices?
Learn With Sandip
What is Terraform?
Terraform is an infrastructure as code (IaC) tool that allows you to
build, change, and version infrastructure safely and efficiently. This
includes low-level components such as compute instances, storage,
and networking, as well as high-level components such as DNS
entries, SaaS features, etc. Terraform can manage both existing
service providers and custom in-house solutions.
AWS CodeBuild: AWS CodeBuild is a fully managed build service that compiles source code, runs tests, and produces software packages that are ready to
deploy. With CodeBuild, you don’t need to provision, manage, and scale your own build servers. CodeBuild scales continuously and processes multiple
builds concurrently, so your builds are not left waiting in a queue.
AWS CodeDeploy: AWS CodeDeploy automates code deployments to any instance, including Amazon EC2 instances and on-premises servers. AWS
CodeDeploy makes it easier for you to rapidly release new features, helps you avoid downtime during application deployment, and handles the complexity
of updating your applications.
AWS CodeCommit: AWS CodeCommit is a fully-managed source control service that makes it easy for companies to host secure and highly scalable
private Git repositories. You can use CodeCommit to securely store anything from source code to binaries, and it works seamlessly with your existing Git
tools.
AWS CodeStar: AWS CodeStar enables you to quickly develop, build, and deploy applications on AWS. AWS CodeStar provides a unified user interface,
enabling you to easily manage your software development activities in one place. With AWS CodeStar, you can set up your entire continuous delivery
toolchain in minutes, allowing you to start releasing code faster.
Microservices
Amazon Elastic Container Service: Amazon Elastic Container Service (ECS) is a highly scalable, high performance container management service that
supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances.
AWS Lambda: AWS Lambda lets you run code without provisioning or managing servers. With Lambda, you can run code for virtually any type of
application or backend service - all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your
code with high availability.
Learn With Sandip
Dockerfile
Learn With Sandip
Dockerfile
Learn With Sandip
Go App + Docker
main.go
Dockerfile
Learn With Sandip
main.tf
terraform {
In this code we have mentioned : required_version = ">= 0.12"
1) What is the minimum required backend "s3" {
terraform version bucket = "terraform-demo-sandip"
key = "terraform.tfstate"
2) Setup AWS S3 as backend , mentioned region = "us-west-2"
bucket name }
}
3) Set AWS as the Provider and setup
default region provider "aws" {
region = var.aws_region
}
stage {
Here we are: name = "Source"
stage { {
Here we are: name = "Build" name = "IMAGE_TAG"
type = "PLAINTEXT"
1) Mentioning our second stage of the action { value = "latest"
pipeline category = "Build" },
configuration = { {
"EnvironmentVariables" = jsonencode( name = "CONTAINER_NAME"
2) Proving all the environment [ type = "PLAINTEXT"
{ value = "pythonAppContainer"
variables required for this build name = "environment" },
project, for non confidential we can type = "PLAINTEXT" ])
value = var.env "ProjectName" =
use type = "PLAINTEXT" and for }, aws_codebuild_project.containerAppBuild.name
secure parameters we should { }
name = "AWS_DEFAULT_REGION" input_artifacts = [
use AWS Parameter store or type = "PLAINTEXT" "SourceArtifact",
value = var.aws_region ]
secret manager }, name = "Build"
{ output_artifacts = [
name = "AWS_ACCOUNT_ID" "BuildArtifact",
3) Make sure provider = “CodeBuild” type = "PARAMETER_STORE" ]
for this stage value = "ACCOUNT_ID" owner = "AWS"
}, provider = "CodeBuild"
{ run_order = 1
4) All Configuration for CodeBuild name = "IMAGE_REPO_NAME" version = "1"
type = "PLAINTEXT" }
Provider is here value = "nodeapp" }
},
Learn With Sandip
Good luck!
I hope you’ll use this knowledge and build
awesome solutions.
GitHub Project Url: Click Here