AWS App Runner is a fully managed service that makes it easy for developers to quickly deploy containerized web applications and APIs, at scale and with no prior infrastructure experience required. Start with your source code or a container image. App Runner automatically builds and deploys the web application and load balances traffic with encryption. App Runner also scales up or down automatically to meet your traffic needs. With App Runner, rather than thinking about servers or scaling, you have more time to focus on your applications.
This repository contains the terraform configuration based script to deploy your application on AWS App Runner.
We have 3 ways to deploy your application on App Runner
terraform.tfvar
according to deployment type.isECR = false
build_command = "Application build command(If required)"
runtime = "Application runtime environment like PYTHON_3 | NODEJS_12"
start_command = "Application start command(If required)"
configuration_source = "REPOSITORY | API"
repository_url = "Github repository url"
repository_branch = "branch name"
port = "Port"
Note: For now you have to configure github connection manually because terraform not allow to approve created github connection automatically. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apprunner_connection When you create github connection you have to allow aws to access you github repository so for that you have to allow that permission manually.
isECR = true
image_repository_type = "ECR"
image_identifier = "ECR repository image uri
port = "Port"
isECR = true
image_repository_type = "ECR_PUBLIC"
image_identifier = "Public image uri"
port = "Port"
Open provider.tf
Add the AWS-CLI profile name the same as we add a profile for s3 backend configuration.
provider "aws" {
region = "${var.region}"
profile = "<AWS-CLI PROFILE NAME>" //If you run this script using AWS EC2 of CodePipeline remove this line
}
Add terraform.tfvars file
cp terraform.sample.tfvars terraform.tfvars
It will create terraform.tfvars
file.
terraform.tfvars has all the required environment variables required for the terraform setup.
Once all changes done we are ready to deploy our terraform.
Run terraform plan
to verify all created resources.
Run terraform apply
to create all resources on the AWS account given region.
If you want to delete infrastructure run terraform destroy
.