Skip to content

Instantly share code, notes, and snippets.

@welshstew
Created October 8, 2020 14:50
Show Gist options
  • Select an option

  • Save welshstew/00b193c7e0f1213a886e35d6bdcb5af1 to your computer and use it in GitHub Desktop.

Select an option

Save welshstew/00b193c7e0f1213a886e35d6bdcb5af1 to your computer and use it in GitHub Desktop.
BlueGreen fargate json files for ECS and CodeDeploy
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "arn:aws:ecs:eu-west-2:1234:task-definition/first-run-task-definition:1"
LoadBalancerInfo:
ContainerName: "sample-app"
ContainerPort: 80
PlatformVersion: "LATEST"
{
"applicationName": "some-bluegreen-app",
"autoRollbackConfiguration": {
"enabled": true,
"events": [ "DEPLOYMENT_FAILURE" ]
},
"blueGreenDeploymentConfiguration": {
"deploymentReadyOption": {
"actionOnTimeout": "CONTINUE_DEPLOYMENT",
"waitTimeInMinutes": 0
},
"terminateBlueInstancesOnDeploymentSuccess": {
"action": "TERMINATE",
"terminationWaitTimeInMinutes": 5
}
},
"deploymentGroupName": "some-bluegreen-dg",
"deploymentStyle": {
"deploymentOption": "WITH_TRAFFIC_CONTROL",
"deploymentType": "BLUE_GREEN"
},
"loadBalancerInfo": {
"targetGroupPairInfoList": [
{
"targetGroups": [
{
"name": "bluegreentarget1"
},
{
"name": "bluegreentarget2"
}
],
"prodTrafficRoute": {
"listenerArns": [
"arn:aws:elasticloadbalancing:eu-west-2:1234:listener/app/bluegreen-alb/567/8910"
]
}
}
]
},
"serviceRoleArn": "arn:aws:iam::1234:role/ecsCodeDeployRole",
"ecsServices": [
{
"serviceName": "service-bluegreen",
"clusterName": "bluegreen-cluster"
}
]
}
{
"applicationName": "some-bluegreen-app",
"deploymentGroupName": "some-bluegreen-dg",
"revision": {
"revisionType": "S3",
"s3Location": {
"bucket": "some-bluegreen-bucket",
"key": "appspec.yaml",
"bundleType": "YAML"
}
}
}
{
"cluster": "bluegreen-cluster",
"serviceName": "service-bluegreen",
"taskDefinition": "some-task-def",
"loadBalancers": [
{
"targetGroupArn": "arn:aws:elasticloadbalancing:eu-west-2:1234:targetgroup/bluegreentarget1/1234",
"containerName": "sample-app",
"containerPort": 80
}
],
"launchType": "FARGATE",
"schedulingStrategy": "REPLICA",
"deploymentController": {
"type": "CODE_DEPLOY"
},
"platformVersion": "LATEST",
"networkConfiguration": {
"awsvpcConfiguration": {
"assignPublicIp": "ENABLED",
"securityGroups": [ "sg-1234" ],
"subnets": [ "subnet-1234", "subnet-5678" ]
}
},
"desiredCount": 1
}
{
"family": "some-task-def",
"networkMode": "awsvpc",
"containerDefinitions": [
{
"name": "sample-app",
"image": "httpd:2.4",
"portMappings": [
{
"containerPort": 80,
"hostPort": 80,
"protocol": "tcp"
}
],
"essential": true,
"entryPoint": [
"sh",
"-c"
],
"command": [
"/bin/sh -c \"echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p> </div></body></html>' > /usr/local/apache2/htdocs/index.html && httpd-foreground\""
]
}
],
"requiresCompatibilities": [
"FARGATE"
],
"cpu": "256",
"memory": "512",
"executionRoleArn": "arn:aws:iam::1234:role/ecsTaskExecutionRole"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment