This article explains on how to create an AWS network in VPC and ECS Cluster using CloudFormation template. It includes the following topics:
To configure ECS, follow the steps below:
- Navigate to AWS CloudFormation -> Stacks -> Create stack.
Note: Before you create a stack, you must have a template that describes what resources AWS CloudFormation will include in your stack.
- Prepare a template.
- Specify the template by uploading zero-vpc-ecs.yaml to create a dedicated VPC.
- Specify stack details by filling in the following information:
- Stack name: zero-vpc
- Parameters: IP CIDR for VPC — 10.8.0.0/16
VPC is successfully created.
- Use zero-mssql.yaml to create a test database. To do that, fill in the following information:
- Stack name: zero-mssql
- ParentVPCStack: zero-vpc
- Fill in the other parameters as required.
Creating an ECS Cluster
To create an ECS cluster, follow the steps below:
- From the CloudFormation console, use zero-ecs.yaml to create the ECS cluster.
Fill in the following information:
- Your ECS cluster name
- Select VPC
- Select public and private subnets
- Your instance type (for details, see Amazon EC2 Instance Types)
- Max and min size of your cluster
Note: This is the number of EC2 instances per cluster. For development and testing purposes both can be set to 1.
- Load Balancer scheme
Note: If you need the application to be accessible from the internet, select "internet-facing."
- Service tasks autoscaling (select true and write max, min, desired count)
- Docker image URI
- Secret manager ARN created in the Preparation page
Note: These options are optional.
- If you need to use HTTPS with a custom FQDN, create a subdomain in your hosted zone and certificate in AWS Certificate Manager. Enter the certificate ARN in LoadBalancerCertificateArn. Afterward, in the route53 hosted zone, alias the subdomain to LoadBalancer FQDN.
Was this article helpful?