2020-05-13 15:32:24 +02:00
|
|
|
{
|
|
|
|
"AWSTemplateFormatVersion": "2010-09-09",
|
2020-05-13 22:09:20 +02:00
|
|
|
"Conditions": {
|
|
|
|
"CreateCluster": {
|
|
|
|
"Fn::Equals": [
|
|
|
|
"",
|
|
|
|
{
|
|
|
|
"Ref": "ParameterClusterName"
|
|
|
|
}
|
|
|
|
]
|
2020-06-04 17:09:41 +02:00
|
|
|
},
|
|
|
|
"CreateLoadBalancer": {
|
|
|
|
"Fn::Equals": [
|
|
|
|
"",
|
|
|
|
{
|
|
|
|
"Ref": "ParameterLoadBalancerARN"
|
|
|
|
}
|
|
|
|
]
|
2020-05-13 22:09:20 +02:00
|
|
|
}
|
|
|
|
},
|
2020-07-27 09:44:42 +02:00
|
|
|
"Description": "CloudFormation template created by Docker for deploying applications on Amazon ECS",
|
2020-05-13 15:32:24 +02:00
|
|
|
"Parameters": {
|
2020-05-13 22:09:20 +02:00
|
|
|
"ParameterClusterName": {
|
|
|
|
"Description": "Name of the ECS cluster to deploy to (optional)",
|
|
|
|
"Type": "String"
|
|
|
|
},
|
2020-06-04 17:09:41 +02:00
|
|
|
"ParameterLoadBalancerARN": {
|
|
|
|
"Description": "Name of the LoadBalancer to connect to (optional)",
|
|
|
|
"Type": "String"
|
|
|
|
},
|
2020-05-13 22:09:20 +02:00
|
|
|
"ParameterSubnet1Id": {
|
2020-06-03 14:31:19 +02:00
|
|
|
"Description": "SubnetId, for Availability Zone 1 in the region in your VPC",
|
2020-05-13 15:32:24 +02:00
|
|
|
"Type": "AWS::EC2::Subnet::Id"
|
|
|
|
},
|
2020-05-13 22:09:20 +02:00
|
|
|
"ParameterSubnet2Id": {
|
2020-06-03 14:31:19 +02:00
|
|
|
"Description": "SubnetId, for Availability Zone 2 in the region in your VPC",
|
2020-05-13 15:32:24 +02:00
|
|
|
"Type": "AWS::EC2::Subnet::Id"
|
|
|
|
},
|
2020-05-13 22:09:20 +02:00
|
|
|
"ParameterVPCId": {
|
2020-05-13 15:32:24 +02:00
|
|
|
"Description": "ID of the VPC",
|
|
|
|
"Type": "AWS::EC2::VPC::Id"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Resources": {
|
|
|
|
"CloudMap": {
|
|
|
|
"Properties": {
|
|
|
|
"Description": "Service Map for Docker Compose project TestSimpleConvert",
|
|
|
|
"Name": "TestSimpleConvert.local",
|
|
|
|
"Vpc": {
|
2020-05-13 22:09:20 +02:00
|
|
|
"Ref": "ParameterVPCId"
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::ServiceDiscovery::PrivateDnsNamespace"
|
|
|
|
},
|
2020-05-13 22:09:20 +02:00
|
|
|
"Cluster": {
|
|
|
|
"Condition": "CreateCluster",
|
|
|
|
"Properties": {
|
|
|
|
"ClusterName": "TestSimpleConvert",
|
|
|
|
"Tags": [
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.project",
|
|
|
|
"Value": "TestSimpleConvert"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Type": "AWS::ECS::Cluster"
|
|
|
|
},
|
2020-05-13 15:32:24 +02:00
|
|
|
"LogGroup": {
|
|
|
|
"Properties": {
|
|
|
|
"LogGroupName": "/docker-compose/TestSimpleConvert"
|
|
|
|
},
|
|
|
|
"Type": "AWS::Logs::LogGroup"
|
|
|
|
},
|
2020-05-27 16:58:58 +02:00
|
|
|
"SimpleService": {
|
2020-07-15 18:02:57 +02:00
|
|
|
"DependsOn": [
|
|
|
|
"SimpleTCP80Listener"
|
|
|
|
],
|
2020-05-13 15:32:24 +02:00
|
|
|
"Properties": {
|
2020-05-13 22:09:20 +02:00
|
|
|
"Cluster": {
|
|
|
|
"Fn::If": [
|
|
|
|
"CreateCluster",
|
|
|
|
{
|
|
|
|
"Ref": "Cluster"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Ref": "ParameterClusterName"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2020-08-06 10:22:55 +02:00
|
|
|
"DeploymentConfiguration": {
|
|
|
|
"MaximumPercent": 200,
|
|
|
|
"MinimumHealthyPercent": 100
|
|
|
|
},
|
|
|
|
"DeploymentController": {
|
|
|
|
"Type": "ECS"
|
|
|
|
},
|
2020-05-13 15:32:24 +02:00
|
|
|
"DesiredCount": 1,
|
|
|
|
"LaunchType": "FARGATE",
|
2020-07-15 18:02:57 +02:00
|
|
|
"LoadBalancers": [
|
|
|
|
{
|
|
|
|
"ContainerName": "simple",
|
|
|
|
"ContainerPort": 80,
|
|
|
|
"TargetGroupArn": {
|
|
|
|
"Ref": "SimpleTCP80TargetGroup"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2020-05-13 15:32:24 +02:00
|
|
|
"NetworkConfiguration": {
|
|
|
|
"AwsvpcConfiguration": {
|
|
|
|
"AssignPublicIp": "ENABLED",
|
2020-05-18 11:36:42 +02:00
|
|
|
"SecurityGroups": [
|
|
|
|
{
|
|
|
|
"Ref": "TestSimpleConvertDefaultNetwork"
|
|
|
|
}
|
|
|
|
],
|
2020-05-13 15:32:24 +02:00
|
|
|
"Subnets": [
|
|
|
|
{
|
2020-05-13 22:09:20 +02:00
|
|
|
"Ref": "ParameterSubnet1Id"
|
2020-05-13 15:32:24 +02:00
|
|
|
},
|
|
|
|
{
|
2020-05-13 22:09:20 +02:00
|
|
|
"Ref": "ParameterSubnet2Id"
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2020-09-08 10:33:06 +02:00
|
|
|
"PlatformVersion": "1.4.0",
|
2020-08-04 18:20:34 +02:00
|
|
|
"PropagateTags": "SERVICE",
|
2020-05-13 15:32:24 +02:00
|
|
|
"SchedulingStrategy": "REPLICA",
|
|
|
|
"ServiceRegistries": [
|
|
|
|
{
|
|
|
|
"RegistryArn": {
|
|
|
|
"Fn::GetAtt": [
|
2020-05-27 16:58:58 +02:00
|
|
|
"SimpleServiceDiscoveryEntry",
|
2020-05-13 15:32:24 +02:00
|
|
|
"Arn"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
2020-05-27 17:00:25 +02:00
|
|
|
"Tags": [
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.project",
|
|
|
|
"Value": "TestSimpleConvert"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.service",
|
|
|
|
"Value": "simple"
|
|
|
|
}
|
|
|
|
],
|
2020-05-13 15:32:24 +02:00
|
|
|
"TaskDefinition": {
|
2020-05-27 16:58:58 +02:00
|
|
|
"Ref": "SimpleTaskDefinition"
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::ECS::Service"
|
|
|
|
},
|
2020-05-27 16:58:58 +02:00
|
|
|
"SimpleServiceDiscoveryEntry": {
|
2020-05-13 15:32:24 +02:00
|
|
|
"Properties": {
|
|
|
|
"Description": "\"simple\" service discovery entry in Cloud Map",
|
|
|
|
"DnsConfig": {
|
|
|
|
"DnsRecords": [
|
|
|
|
{
|
2020-05-27 14:34:17 +02:00
|
|
|
"TTL": 60,
|
2020-05-13 15:32:24 +02:00
|
|
|
"Type": "A"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"RoutingPolicy": "MULTIVALUE"
|
|
|
|
},
|
2020-06-15 09:41:01 +02:00
|
|
|
"HealthCheckCustomConfig": {
|
|
|
|
"FailureThreshold": 1
|
|
|
|
},
|
2020-05-13 15:32:24 +02:00
|
|
|
"Name": "simple",
|
|
|
|
"NamespaceId": {
|
|
|
|
"Ref": "CloudMap"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::ServiceDiscovery::Service"
|
|
|
|
},
|
2020-07-15 18:02:57 +02:00
|
|
|
"SimpleTCP80Listener": {
|
|
|
|
"Properties": {
|
|
|
|
"DefaultActions": [
|
|
|
|
{
|
|
|
|
"ForwardConfig": {
|
|
|
|
"TargetGroups": [
|
|
|
|
{
|
|
|
|
"TargetGroupArn": {
|
|
|
|
"Ref": "SimpleTCP80TargetGroup"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Type": "forward"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"LoadBalancerArn": {
|
|
|
|
"Fn::If": [
|
|
|
|
"CreateLoadBalancer",
|
|
|
|
{
|
|
|
|
"Ref": "TestSimpleConvertLoadBalancer"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Ref": "ParameterLoadBalancerARN"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Port": 80,
|
|
|
|
"Protocol": "HTTP"
|
|
|
|
},
|
|
|
|
"Type": "AWS::ElasticLoadBalancingV2::Listener"
|
|
|
|
},
|
|
|
|
"SimpleTCP80TargetGroup": {
|
|
|
|
"Properties": {
|
|
|
|
"Port": 80,
|
|
|
|
"Protocol": "HTTP",
|
|
|
|
"Tags": [
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.project",
|
|
|
|
"Value": "TestSimpleConvert"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"TargetType": "ip",
|
|
|
|
"VpcId": {
|
|
|
|
"Ref": "ParameterVPCId"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup"
|
|
|
|
},
|
2020-05-27 16:58:58 +02:00
|
|
|
"SimpleTaskDefinition": {
|
2020-05-13 15:32:24 +02:00
|
|
|
"Properties": {
|
|
|
|
"ContainerDefinitions": [
|
|
|
|
{
|
|
|
|
"Environment": [
|
|
|
|
{
|
|
|
|
"Name": "LOCALDOMAIN",
|
|
|
|
"Value": {
|
|
|
|
"Fn::Join": [
|
|
|
|
"",
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Ref": "AWS::Region"
|
|
|
|
},
|
|
|
|
".compute.internal",
|
|
|
|
" TestSimpleConvert.local"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"Essential": true,
|
2020-07-08 16:07:13 +02:00
|
|
|
"Image": "nginx",
|
2020-05-13 15:32:24 +02:00
|
|
|
"LinuxParameters": {},
|
|
|
|
"LogConfiguration": {
|
|
|
|
"LogDriver": "awslogs",
|
|
|
|
"Options": {
|
|
|
|
"awslogs-group": {
|
|
|
|
"Ref": "LogGroup"
|
|
|
|
},
|
|
|
|
"awslogs-region": {
|
|
|
|
"Ref": "AWS::Region"
|
|
|
|
},
|
2020-05-27 16:58:58 +02:00
|
|
|
"awslogs-stream-prefix": "TestSimpleConvert"
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
},
|
2020-07-15 18:02:57 +02:00
|
|
|
"Name": "simple",
|
|
|
|
"PortMappings": [
|
|
|
|
{
|
|
|
|
"ContainerPort": 80,
|
|
|
|
"HostPort": 80,
|
|
|
|
"Protocol": "tcp"
|
|
|
|
}
|
|
|
|
]
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"Cpu": "256",
|
|
|
|
"ExecutionRoleArn": {
|
2020-05-27 16:58:58 +02:00
|
|
|
"Ref": "SimpleTaskExecutionRole"
|
2020-05-13 15:32:24 +02:00
|
|
|
},
|
2020-06-02 14:17:48 +02:00
|
|
|
"Family": "TestSimpleConvert-simple",
|
2020-05-13 15:32:24 +02:00
|
|
|
"Memory": "512",
|
|
|
|
"NetworkMode": "awsvpc",
|
|
|
|
"RequiresCompatibilities": [
|
|
|
|
"FARGATE"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Type": "AWS::ECS::TaskDefinition"
|
|
|
|
},
|
2020-05-27 16:58:58 +02:00
|
|
|
"SimpleTaskExecutionRole": {
|
2020-05-13 15:32:24 +02:00
|
|
|
"Properties": {
|
|
|
|
"AssumeRolePolicyDocument": {
|
|
|
|
"Statement": [
|
|
|
|
{
|
|
|
|
"Action": [
|
|
|
|
"sts:AssumeRole"
|
|
|
|
],
|
|
|
|
"Effect": "Allow",
|
|
|
|
"Principal": {
|
|
|
|
"Service": "ecs-tasks.amazonaws.com"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"Version": "2012-10-17"
|
|
|
|
},
|
|
|
|
"ManagedPolicyArns": [
|
2020-05-25 16:49:58 +02:00
|
|
|
"arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
|
|
|
|
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
|
2020-05-13 15:32:24 +02:00
|
|
|
]
|
|
|
|
},
|
|
|
|
"Type": "AWS::IAM::Role"
|
2020-05-27 16:58:58 +02:00
|
|
|
},
|
|
|
|
"TestSimpleConvertDefaultNetwork": {
|
|
|
|
"Properties": {
|
|
|
|
"GroupDescription": "TestSimpleConvert default Security Group",
|
|
|
|
"GroupName": "TestSimpleConvertDefaultNetwork",
|
2020-07-15 18:02:57 +02:00
|
|
|
"SecurityGroupIngress": [
|
|
|
|
{
|
|
|
|
"CidrIp": "0.0.0.0/0",
|
|
|
|
"Description": "simple:80/tcp",
|
|
|
|
"FromPort": 80,
|
|
|
|
"IpProtocol": "TCP",
|
|
|
|
"ToPort": 80
|
|
|
|
}
|
|
|
|
],
|
2020-05-27 16:58:58 +02:00
|
|
|
"Tags": [
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.project",
|
|
|
|
"Value": "TestSimpleConvert"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.network",
|
|
|
|
"Value": "default"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"VpcId": {
|
|
|
|
"Ref": "ParameterVPCId"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::EC2::SecurityGroup"
|
2020-05-28 16:45:53 +02:00
|
|
|
},
|
|
|
|
"TestSimpleConvertDefaultNetworkIngress": {
|
|
|
|
"Properties": {
|
|
|
|
"Description": "Allow communication within network default",
|
|
|
|
"GroupId": {
|
|
|
|
"Ref": "TestSimpleConvertDefaultNetwork"
|
|
|
|
},
|
|
|
|
"IpProtocol": "-1",
|
|
|
|
"SourceSecurityGroupId": {
|
|
|
|
"Ref": "TestSimpleConvertDefaultNetwork"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Type": "AWS::EC2::SecurityGroupIngress"
|
2020-06-04 11:39:47 +02:00
|
|
|
},
|
2020-06-04 18:04:16 +02:00
|
|
|
"TestSimpleConvertLoadBalancer": {
|
2020-06-04 17:09:41 +02:00
|
|
|
"Condition": "CreateLoadBalancer",
|
2020-06-04 11:39:47 +02:00
|
|
|
"Properties": {
|
2020-06-04 18:04:16 +02:00
|
|
|
"Name": "TestSimpleConvertLoadBalancer",
|
2020-06-04 11:39:47 +02:00
|
|
|
"Scheme": "internet-facing",
|
2020-06-05 11:38:27 +02:00
|
|
|
"SecurityGroups": [
|
|
|
|
{
|
|
|
|
"Ref": "TestSimpleConvertDefaultNetwork"
|
|
|
|
}
|
|
|
|
],
|
2020-06-04 11:39:47 +02:00
|
|
|
"Subnets": [
|
|
|
|
{
|
|
|
|
"Ref": "ParameterSubnet1Id"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"Ref": "ParameterSubnet2Id"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"Tags": [
|
|
|
|
{
|
|
|
|
"Key": "com.docker.compose.project",
|
|
|
|
"Value": "TestSimpleConvert"
|
|
|
|
}
|
|
|
|
],
|
2020-06-05 10:32:30 +02:00
|
|
|
"Type": "application"
|
2020-06-04 11:39:47 +02:00
|
|
|
},
|
|
|
|
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer"
|
2020-05-13 15:32:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|