Load Balanced Web Service
List of all available properties for a 'Load Balanced Web Service'
manifest.
# Your service name will be used in naming your resources like log groups, ECS services, etc.
name: frontend
# The "architecture" of the service you're running.
type: Load Balanced Web Service
image:
# Path to your service's Dockerfile.
build: ./Dockerfile
# Or instead of building, you can specify an existing image name.
location: aws_account_id.dkr.ecr.region.amazonaws.com/my-svc:tag
# Port exposed through your container to route traffic to it.
port: 80
http:
# Requests to this path will be forwarded to your service.
# To match all requests you can use the "/" path.
path: '/'
# You can specify a custom health check path. The default is "/"
# healthcheck: "/"
# You can specify whether to enable sticky sessions.
# stickiness: true
# Number of CPU units for the task.
cpu: 256
# Amount of memory in MiB used by the task.
memory: 512
# Number of tasks that should be running in your service. You can also specify a map for autoscaling.
count: 1
variables: # Optional. Pass environment variables as key value pairs.
LOG_LEVEL: info
secrets: # Optional. Pass secrets from AWS Systems Manager (SSM) Parameter Store.
GITHUB_TOKEN: GITHUB_TOKEN # The key is the name of the environment variable, the value is the name of the SSM parameter.
# Optional. You can override any of the values defined above by environment.
environments:
test:
count: 2 # Number of tasks to run for the "test" environment.
name
String
The name of your service.
type
String
The architecture type for your service. A Load Balanced Web Service is an internet-facing service that's behind a load balancer, orchestrated by Amazon ECS on AWS Fargate.
image
Map
The image section contains parameters relating to the Docker build configuration and exposed port.
image.build
String or Map
If you specify a string, Copilot interprets it as the path to your Dockerfile. It will assume that the dirname of the string you specify should be the build context. The manifest:
image:
build: path/to/dockerfile
$ docker build --file path/to/dockerfile path/to
You can also specify build as a map:
image:
build:
dockerfile: path/to/dockerfile
context: context/dir
target: build-stage
cache_from:
- image:tag
args:
key: value
$ docker build --file path/to/dockerfile --target build-stage --cache-from image:tag --build-arg key=value context/dir
.
You can omit fields and Copilot will do its best to understand what you mean. For example, if you specify context
but not dockerfile
, Copilot will run Docker in the context directory and assume that your Dockerfile is named "Dockerfile." If you specify dockerfile
but no context
, Copilot assumes you want to run Docker in the directory that contains dockerfile
.
All paths are relative to your workspace root.
image.location
String
Instead of building a container from a Dockerfile, you can specify an existing image name. Mutually exclusive with image.build
.
The location
field follows the same definition as the image
parameter in the Amazon ECS task definition.
image.port
Integer
The port exposed in your Dockerfile. Copilot should parse this value for you from your EXPOSE
instruction.
http
Map
The http section contains parameters related to integrating your service with an Application Load Balancer.
http.path
String
Requests to this path will be forwarded to your service. Each Load Balanced Web Service should listen on a unique path.
http.healthcheck
String or Map
If you specify a string, Copilot interprets it as the path exposed in your container to handle target group health check requests. The default is "/".
http:
healthcheck: '/'
http:
healthcheck:
path: '/'
healthy_threshold: 3
unhealthy_threshold: 2
interval: 15s
timeout: 10s
http.healthcheck.healthy_threshold
Integer
The number of consecutive health check successes required before considering an unhealthy target healthy. The Copilot default is 2. Range: 2-10.
http.healthcheck.unhealthy_threshold
Integer
The number of consecutive health check failures required before considering a target unhealthy. The Copilot default is 2. Range: 2-10.
http.healthcheck.interval
Duration
The approximate amount of time, in seconds, between health checks of an individual target. The Copilot default is 10s. Range: 5s–300s.
http.healthcheck.timeout
Duration
The amount of time, in seconds, during which no response from a target means a failed health check. The Copilot default is 5s. Range 5s-300s.
http.target_container
String
A sidecar container that takes the place of a service container.
http.stickiness
Boolean
Indicates whether sticky sessions are enabled.
http.allowed_source_ips
Array of Strings
CIDR IP addresses permitted to access your service.
http:
allowed_source_ips: ["192.0.2.0/24", "198.51.100.10/32"]
cpu
Integer
Number of CPU units for the task. See the Amazon ECS docs for valid CPU values.
memory
Integer
Amount of memory in MiB used by the task. See the Amazon ECS docs for valid memory values.
count
Integer or Map
If you specify a number:
count: 5
Alternatively, you can specify a map for setting up autoscaling:
count:
range: 1-10
cpu_percentage: 70
memory_percentage: 80
requests: 10000
response_time: 2s
count.range
String
Specify a minimum and maximum bound for the number of tasks your service should maintain.
count.cpu_percentage
Integer
Scale up or down based on the average CPU your service should maintain.
count.memory_percentage
Integer
Scale up or down based on the average memory your service should maintain.
count.requests
Integer
Scale up or down based on the request count handled per tasks.
count.response_time
Duration
Scale up or down based on the service average response time.
variables
Map
Key-value pairs that represent environment variables that will be passed to your service. Copilot will include a number of environment variables by default for you.
secrets
Map
Key-value pairs that represent secret values from AWS Systems Manager Parameter Store that will be securely passed to your service as environment variables.
environments
Map
The environment section lets you override any value in your manifest based on the environment you're in. In the example manifest above, we're overriding the count parameter so that we can run 2 copies of our service in our prod environment.