simple-cloudformation-conversion.golden 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. {
  2. "AWSTemplateFormatVersion": "2010-09-09",
  3. "Conditions": {
  4. "CreateCluster": {
  5. "Fn::Equals": [
  6. "",
  7. {
  8. "Ref": "ParameterClusterName"
  9. }
  10. ]
  11. },
  12. "CreateLoadBalancer": {
  13. "Fn::Equals": [
  14. "",
  15. {
  16. "Ref": "ParameterLoadBalancerARN"
  17. }
  18. ]
  19. }
  20. },
  21. "Description": "CloudFormation template created by Docker for deploying applications on Amazon ECS",
  22. "Parameters": {
  23. "ParameterClusterName": {
  24. "Description": "Name of the ECS cluster to deploy to (optional)",
  25. "Type": "String"
  26. },
  27. "ParameterLoadBalancerARN": {
  28. "Description": "Name of the LoadBalancer to connect to (optional)",
  29. "Type": "String"
  30. },
  31. "ParameterSubnet1Id": {
  32. "Description": "SubnetId, for Availability Zone 1 in the region in your VPC",
  33. "Type": "AWS::EC2::Subnet::Id"
  34. },
  35. "ParameterSubnet2Id": {
  36. "Description": "SubnetId, for Availability Zone 2 in the region in your VPC",
  37. "Type": "AWS::EC2::Subnet::Id"
  38. },
  39. "ParameterVPCId": {
  40. "Description": "ID of the VPC",
  41. "Type": "AWS::EC2::VPC::Id"
  42. }
  43. },
  44. "Resources": {
  45. "CloudMap": {
  46. "Properties": {
  47. "Description": "Service Map for Docker Compose project TestSimpleConvert",
  48. "Name": "TestSimpleConvert.local",
  49. "Vpc": {
  50. "Ref": "ParameterVPCId"
  51. }
  52. },
  53. "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace"
  54. },
  55. "Cluster": {
  56. "Condition": "CreateCluster",
  57. "Properties": {
  58. "ClusterName": "TestSimpleConvert",
  59. "Tags": [
  60. {
  61. "Key": "com.docker.compose.project",
  62. "Value": "TestSimpleConvert"
  63. }
  64. ]
  65. },
  66. "Type": "AWS::ECS::Cluster"
  67. },
  68. "LogGroup": {
  69. "Properties": {
  70. "LogGroupName": "/docker-compose/TestSimpleConvert"
  71. },
  72. "Type": "AWS::Logs::LogGroup"
  73. },
  74. "SimpleService": {
  75. "DependsOn": [
  76. "SimpleTCP80Listener"
  77. ],
  78. "Properties": {
  79. "Cluster": {
  80. "Fn::If": [
  81. "CreateCluster",
  82. {
  83. "Ref": "Cluster"
  84. },
  85. {
  86. "Ref": "ParameterClusterName"
  87. }
  88. ]
  89. },
  90. "DeploymentConfiguration": {
  91. "MaximumPercent": 200,
  92. "MinimumHealthyPercent": 100
  93. },
  94. "DeploymentController": {
  95. "Type": "ECS"
  96. },
  97. "DesiredCount": 1,
  98. "LaunchType": "FARGATE",
  99. "LoadBalancers": [
  100. {
  101. "ContainerName": "simple",
  102. "ContainerPort": 80,
  103. "TargetGroupArn": {
  104. "Ref": "SimpleTCP80TargetGroup"
  105. }
  106. }
  107. ],
  108. "NetworkConfiguration": {
  109. "AwsvpcConfiguration": {
  110. "AssignPublicIp": "ENABLED",
  111. "SecurityGroups": [
  112. {
  113. "Ref": "TestSimpleConvertDefaultNetwork"
  114. }
  115. ],
  116. "Subnets": [
  117. {
  118. "Ref": "ParameterSubnet1Id"
  119. },
  120. {
  121. "Ref": "ParameterSubnet2Id"
  122. }
  123. ]
  124. }
  125. },
  126. "PropagateTags": "SERVICE",
  127. "SchedulingStrategy": "REPLICA",
  128. "ServiceRegistries": [
  129. {
  130. "RegistryArn": {
  131. "Fn::GetAtt": [
  132. "SimpleServiceDiscoveryEntry",
  133. "Arn"
  134. ]
  135. }
  136. }
  137. ],
  138. "Tags": [
  139. {
  140. "Key": "com.docker.compose.project",
  141. "Value": "TestSimpleConvert"
  142. },
  143. {
  144. "Key": "com.docker.compose.service",
  145. "Value": "simple"
  146. }
  147. ],
  148. "TaskDefinition": {
  149. "Ref": "SimpleTaskDefinition"
  150. }
  151. },
  152. "Type": "AWS::ECS::Service"
  153. },
  154. "SimpleServiceDiscoveryEntry": {
  155. "Properties": {
  156. "Description": "\"simple\" service discovery entry in Cloud Map",
  157. "DnsConfig": {
  158. "DnsRecords": [
  159. {
  160. "TTL": 60,
  161. "Type": "A"
  162. }
  163. ],
  164. "RoutingPolicy": "MULTIVALUE"
  165. },
  166. "HealthCheckCustomConfig": {
  167. "FailureThreshold": 1
  168. },
  169. "Name": "simple",
  170. "NamespaceId": {
  171. "Ref": "CloudMap"
  172. }
  173. },
  174. "Type": "AWS::ServiceDiscovery::Service"
  175. },
  176. "SimpleTCP80Listener": {
  177. "Properties": {
  178. "DefaultActions": [
  179. {
  180. "ForwardConfig": {
  181. "TargetGroups": [
  182. {
  183. "TargetGroupArn": {
  184. "Ref": "SimpleTCP80TargetGroup"
  185. }
  186. }
  187. ]
  188. },
  189. "Type": "forward"
  190. }
  191. ],
  192. "LoadBalancerArn": {
  193. "Fn::If": [
  194. "CreateLoadBalancer",
  195. {
  196. "Ref": "TestSimpleConvertLoadBalancer"
  197. },
  198. {
  199. "Ref": "ParameterLoadBalancerARN"
  200. }
  201. ]
  202. },
  203. "Port": 80,
  204. "Protocol": "HTTP"
  205. },
  206. "Type": "AWS::ElasticLoadBalancingV2::Listener"
  207. },
  208. "SimpleTCP80TargetGroup": {
  209. "Properties": {
  210. "Port": 80,
  211. "Protocol": "HTTP",
  212. "Tags": [
  213. {
  214. "Key": "com.docker.compose.project",
  215. "Value": "TestSimpleConvert"
  216. }
  217. ],
  218. "TargetType": "ip",
  219. "VpcId": {
  220. "Ref": "ParameterVPCId"
  221. }
  222. },
  223. "Type": "AWS::ElasticLoadBalancingV2::TargetGroup"
  224. },
  225. "SimpleTaskDefinition": {
  226. "Properties": {
  227. "ContainerDefinitions": [
  228. {
  229. "Environment": [
  230. {
  231. "Name": "LOCALDOMAIN",
  232. "Value": {
  233. "Fn::Join": [
  234. "",
  235. [
  236. {
  237. "Ref": "AWS::Region"
  238. },
  239. ".compute.internal",
  240. " TestSimpleConvert.local"
  241. ]
  242. ]
  243. }
  244. }
  245. ],
  246. "Essential": true,
  247. "Image": "nginx",
  248. "LinuxParameters": {},
  249. "LogConfiguration": {
  250. "LogDriver": "awslogs",
  251. "Options": {
  252. "awslogs-group": {
  253. "Ref": "LogGroup"
  254. },
  255. "awslogs-region": {
  256. "Ref": "AWS::Region"
  257. },
  258. "awslogs-stream-prefix": "TestSimpleConvert"
  259. }
  260. },
  261. "Name": "simple",
  262. "PortMappings": [
  263. {
  264. "ContainerPort": 80,
  265. "HostPort": 80,
  266. "Protocol": "tcp"
  267. }
  268. ]
  269. }
  270. ],
  271. "Cpu": "256",
  272. "ExecutionRoleArn": {
  273. "Ref": "SimpleTaskExecutionRole"
  274. },
  275. "Family": "TestSimpleConvert-simple",
  276. "Memory": "512",
  277. "NetworkMode": "awsvpc",
  278. "RequiresCompatibilities": [
  279. "FARGATE"
  280. ]
  281. },
  282. "Type": "AWS::ECS::TaskDefinition"
  283. },
  284. "SimpleTaskExecutionRole": {
  285. "Properties": {
  286. "AssumeRolePolicyDocument": {
  287. "Statement": [
  288. {
  289. "Action": [
  290. "sts:AssumeRole"
  291. ],
  292. "Effect": "Allow",
  293. "Principal": {
  294. "Service": "ecs-tasks.amazonaws.com"
  295. }
  296. }
  297. ],
  298. "Version": "2012-10-17"
  299. },
  300. "ManagedPolicyArns": [
  301. "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy",
  302. "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
  303. ]
  304. },
  305. "Type": "AWS::IAM::Role"
  306. },
  307. "TestSimpleConvertDefaultNetwork": {
  308. "Properties": {
  309. "GroupDescription": "TestSimpleConvert default Security Group",
  310. "GroupName": "TestSimpleConvertDefaultNetwork",
  311. "SecurityGroupIngress": [
  312. {
  313. "CidrIp": "0.0.0.0/0",
  314. "Description": "simple:80/tcp",
  315. "FromPort": 80,
  316. "IpProtocol": "TCP",
  317. "ToPort": 80
  318. }
  319. ],
  320. "Tags": [
  321. {
  322. "Key": "com.docker.compose.project",
  323. "Value": "TestSimpleConvert"
  324. },
  325. {
  326. "Key": "com.docker.compose.network",
  327. "Value": "default"
  328. }
  329. ],
  330. "VpcId": {
  331. "Ref": "ParameterVPCId"
  332. }
  333. },
  334. "Type": "AWS::EC2::SecurityGroup"
  335. },
  336. "TestSimpleConvertDefaultNetworkIngress": {
  337. "Properties": {
  338. "Description": "Allow communication within network default",
  339. "GroupId": {
  340. "Ref": "TestSimpleConvertDefaultNetwork"
  341. },
  342. "IpProtocol": "-1",
  343. "SourceSecurityGroupId": {
  344. "Ref": "TestSimpleConvertDefaultNetwork"
  345. }
  346. },
  347. "Type": "AWS::EC2::SecurityGroupIngress"
  348. },
  349. "TestSimpleConvertLoadBalancer": {
  350. "Condition": "CreateLoadBalancer",
  351. "Properties": {
  352. "Name": "TestSimpleConvertLoadBalancer",
  353. "Scheme": "internet-facing",
  354. "SecurityGroups": [
  355. {
  356. "Ref": "TestSimpleConvertDefaultNetwork"
  357. }
  358. ],
  359. "Subnets": [
  360. {
  361. "Ref": "ParameterSubnet1Id"
  362. },
  363. {
  364. "Ref": "ParameterSubnet2Id"
  365. }
  366. ],
  367. "Tags": [
  368. {
  369. "Key": "com.docker.compose.project",
  370. "Value": "TestSimpleConvert"
  371. }
  372. ],
  373. "Type": "application"
  374. },
  375. "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer"
  376. }
  377. }
  378. }