Terraform Apply
Setting Terraform Variables
Section titled “Setting Terraform Variables”Before deploying, configure the Terraform variables in terraform.tfvars. The terraform-aws-ecs-express-mode-demo project exposes four input variables — all have defaults, so you only need to override values you want to change.
Create a terraform.tfvars file in the repository root:
project = "ecs-express-mode-demo"environment = "dev"aws_region = "ap-southeast-2"vpc_cidr = "10.42.0.0/16"| Variable | Type | Description |
|---|---|---|
project | string | Project name used for resource naming and tagging. Lowercase alphanumeric characters and hyphens only; 3–50 characters. |
environment | string | Deployment environment. Must be one of |
aws_region | string | AWS region for resource deployment. Must support your chosen Bedrock foundation model. |
vpc_cidr | string | CIDR block for the VPC created by this project (for example,
|
Initializing Terraform
Section titled “Initializing Terraform”Run terraform init to download provider plugins and initialize the working directory. This step fetches the AWS provider and prepares the local state:
terraform initYou should see output confirming that providers were installed and Terraform is ready:
Initializing the backend...Initializing provider plugins...- Finding latest version of hashicorp/aws...- Installing hashicorp/aws...
Terraform has been successfully initialized!Running Terraform Apply
Section titled “Running Terraform Apply”With variables configured and providers initialized, run terraform apply to create all resources:
terraform applyTerraform displays a plan showing the resources it will create. Review the plan and type yes to confirm. The Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs. resource triggers Express Mode to provision its managed infrastructure alongside your declared resources.
What Express Mode Provisions
Section titled “What Express Mode Provisions”When Terraform applies the Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs. resource, ECS Express Mode automatically provisions several managed resources that you would otherwise configure manually with classic ECS:
| Resource | What Express Mode Does |
|---|---|
Creates or reuses a shared ALB in the VPC with Host header routing rules. Up to 25 Express services share a single ALB. | |
| Target group | Registers ECS tasks automatically and configures health checks using the
|
| Auto scaling | Configures target tracking scaling based on the
|
DNS / Application URL | Assigns a unique HTTPS endpoint on
|
| RollbackAlarm A CloudWatch metric alarm created by Express Mode that triggers automatic deployment rollback when new tasks fail ALB health checks. | Creates a CloudWatch alarm that triggers automatic deployment rollback when new tasks fail ALB health checks. |
After Apply Completes
Section titled “After Apply Completes”Once terraform apply finishes successfully, Terraform outputs the Application URL
The unique Express-provisioned HTTPS URL on *.ecs.<region>.on.aws used for all normal application traffic. and other resource identifiers. The next step is verifying the service is healthy and accessible — covered on the Verifying page.
terraform output