ECSFargateService
A service hosted on AWS ECS Fargate.
Like all Services, this class configures itself across multiple Environments.
For more information see the official documentation.
Example Usage
1import launchflow as lf
2
3# Automatically creates / connects to an ECS Fargate Service in your AWS account
4service = lf.aws.ECSFargateService("my-service")
NOTE: This will create the following infrastructure in your AWS account:
- A ECS Fargate service with the specified configuration.
- An Application Load Balancer to route traffic to the service.
- A Code Build project that builds and deploys Docker images for the service.
- An Elastic Container Registry repository to store the service's Docker image.
initialization
Creates a new ECS Fargate service.
Args:
name (str)
: The name of the service.cpu (int)
: The CPU units to allocate to the container. Defaults to 256.memory (int)
: The memory to allocate to the container. Defaults to 512.port (int)
: The port the container listens on. Defaults to 80.desired_count (int)
: The number of tasks to run. Defaults to 1.build_directory (str)
: The directory to build the service from. This should be a relative path from the project root where yourlaunchflow.yaml
is defined.dockerfile (str)
: The Dockerfile to use for building the service. This should be a relative path from thebuild_directory
.build_ignore (List[str])
: A list of files to ignore when building the service. This can be in the same syntax you would use for a.gitignore
.domain (Optional[str])
: The domain name to use for the service. This will create an ACM certificate and configure the ALB to use HTTPS.certificate (Optional[ACMCertificate])
: An existing ACM certificate to use for the service. This will configure the ALB to use HTTPS.cluster (Optional[ECSCluster])
: The ECS cluster to use for the service. If not provided, a new cluster will be created.