Fargate service.
Install Node.js and npm first!
npm i @cfn-modules/fargate-service
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'cfn-modules example'
Resources:
Service:
Type: 'AWS::CloudFormation::Stack'
Properties:
Parameters:
VpcModule: !GetAtt 'Vpc.Outputs.StackName' # required
ClusterModule: !GetAtt 'Cluster.Outputs.StackName' # optional
TargetModule: '' # optional
AlertingModule: '' # optional
ClientSgModule1: '' # optional
ClientSgModule2: '' # optional
ClientSgModule3: '' # optional
ManagedPolicyArns: '' # optional
ProxyImage: '' # optional
ProxyPort: '8000' # optional
ProxyEnvironment1Key: '' # optional
ProxyEnvironment1Value: '' # optional
ProxyEnvironment2Key: '' # optional
ProxyEnvironment2Value: '' # optional
ProxyEnvironment3Key: '' # optional
ProxyEnvironment3Value: '' # optional
AppImage: 'widdix/hello:v1' # optional
AppPort: '80' # optional
AppEnvironment1Key: '' # optional
AppEnvironment1Value: '' # optional
AppEnvironment2Key: '' # optional
AppEnvironment2Value: '' # optional
AppEnvironment3Key: '' # optional
AppEnvironment3Value: '' # optional
AppEnvironment4Key: '' # optional
AppEnvironment4Value: '' # optional
AppEnvironment5Key: '' # optional
AppEnvironment5Value: '' # optional
AppEnvironment6Key: '' # optional
AppEnvironment6Value: '' # optional
SidecarImage: '' # optional
SidecarPort: '9000' # optional
SidecarEnvironment1Key: '' # optional
SidecarEnvironment1Value: '' # optional
SidecarEnvironment2Key: '' # optional
SidecarEnvironment2Value: '' # optional
SidecarEnvironment3Key: '' # optional
SidecarEnvironment3Value: '' # optional
Cpu: '0.25' # optional
Memory: '0.5' # optional
DesiredCount: '2' # optional
MaxCapacity: '4' # optional
MinCapacity: '2' # optional
LogsRetentionInDays: '14' # optional
SubnetsReach: 'Public' # optional
AutoScaling: 'true' # optional
HealthCheckGracePeriodSeconds: '60' # optional
TemplateURL: './node_modules/@cfn-modules/fargate-service/module.yml'
Name | Description | Default | Required? | Allowed values |
---|---|---|---|---|
VpcModule | Stack name of vpc module | yes | ||
ClusterModule | Stack name of ecs-cluster module (if empty, an ECS cluster is created) | no | ||
TargetModule | Stack name of module implementing Target | no | ||
AlertingModule | Stack name of alerting module | no | ||
ClientSgModule1 | Stack name of client-sg module module to mark traffic from EC2 instance | no | ||
ClientSgModule2 | Stack name of client-sg module module to mark traffic from EC2 instance | no | ||
ClientSgModule3 | Stack name of client-sg module module to mark traffic from EC2 instance | no | ||
ManagedPolicyArns | Comma-delimited list of IAM managed policy ARNs to attach to the task's IAM role | no | ||
ProxyImage | Docker image to use for the proxy container. You can use images in the Docker Hub registry or specify other repositories (repository-url/image:tag) | no | ||
ProxyPort | The port exposed by the proxy container that receives traffic from the load balancer (ProxyPort != AppPort != SidecarPort; ignored if ProxyImage and/or TargetModule are/is not set) | 8000 | no | |
ProxyEnvironment1Key | Environment variable 1 key for proxy container | no | ||
ProxyEnvironment1Value | Environment variable 1 value for proxy container | no | ||
ProxyEnvironment2Key | Environment variable 2 key for proxy container | no | ||
ProxyEnvironment2Value | Environment variable 2 value for proxy container | no | ||
ProxyEnvironment3Key | Environment variable 3 key for proxy container | no | ||
ProxyEnvironment3Value | Environment variable 3 value for proxy container | no | ||
AppImage | The Docker image to use for the app container. You can use images in the Docker Hub registry or specify other repositories (repository-url/image:tag) | widdix/hello:v1 | no | |
AppPort | The port exposed by the app container that receives traffic from the load balancer or the proxy container (AppPort != ProxyPort != SidecarPort; ignored if TargetModule is not set) | 80 | no | |
AppEnvironment1Key | Environment variable 1 key for app container | no | ||
AppEnvironment1Value | Environment variable 1 value for app container | no | ||
AppEnvironment2Key | Environment variable 2 key for app container | no | ||
AppEnvironment2Value | Environment variable 2 value for app container | no | ||
AppEnvironment3Key | Environment variable 3 key for app container | no | ||
AppEnvironment3Value | Environment variable 3 value for app container | no | ||
AppEnvironment4Key | Environment variable 4 key for app container | no | ||
AppEnvironment4Value | Environment variable 4 value for app container | no | ||
AppEnvironment5Key | Environment variable 5 key for app container | no | ||
AppEnvironment5Value | Environment variable 5 value for app container | no | ||
AppEnvironment6Key | Environment variable 6 key for app container | no | ||
AppEnvironment6Value | Environment variable 6 value for app container | no | ||
SidecarImage | Docker image to use for the sidecar container. You can use images in the Docker Hub registry or specify other repositories (repository-url/image:tag) | no | ||
SidecarPort | The port exposed by the sidecar container reachable from the app container on host localhost (SidecarPort != ProxyPort != AppPort) | 9000 | no | |
SidecarEnvironment1Key | Environment variable 1 key for sidecar container | no | ||
SidecarEnvironment1Value | Environment variable 1 value for sidecar container | no | ||
SidecarEnvironment2Key | Environment variable 2 key for sidecar container | no | ||
SidecarEnvironment2Value | Environment variable 2 value for sidecar container | no | ||
SidecarEnvironment3Key | Environment variable 3 key for sidecar container | no | ||
SidecarEnvironment3Value | Environment variable 3 value for sidecar container | no | ||
Cpu | The minimum number of vCPUs to reserve for the container | 0.25 | no | [0.25, 0.5, 1, 2, 4] |
Memory | The amount (in GB) of memory used by the task | 0.5 | no | [0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30] |
DesiredCount | The number of simultaneous tasks, that you want to run on the cluster | 2 | no | 1-N |
MaxCapacity | The maximum number of simultaneous tasks, that you want to run on the cluster | 4 | no | 1-N |
MinCapacity | The minimum number of simultaneous tasks, that you want to run on the cluster | 2 | no | 1-N |
LogsRetentionInDays | Specifies the number of days you want to retain log events in the specified log group | 14 | no | [1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653] |
SubnetsReach | Should the service have direct access to the Internet or do you prefer private subnets with NAT? | Public | no | [Public, Private] |
AutoScaling | Scale number of tasks based on CPU load? | true | no | [true, false] |
HealthCheckGracePeriodSeconds | The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started (ignored if TargetModule is not set) | 60 | no | 0-1800 |
- Rename
AmbassadorImage
toProxyImage
. - Rename
AmbassadorPort
toProxyPort
. - Rename
AmbassadorEnvironment1Key
toProxyEnvironment1Key
. - Rename
AmbassadorEnvironment1Value
toProxyEnvironment1Value
. - Rename
AmbassadorEnvironment2Key
toProxyEnvironment2Key
. - Rename
AmbassadorEnvironment2Value
toProxyEnvironment2Value
. - Rename
AmbassadorEnvironment3Key
toProxyEnvironment3Key
. - Rename
AmbassadorEnvironment3Value
toProxyEnvironment3Value
.