Cloud Formation Designer Configuration
parent
a7df4e246e
commit
d532dba464
|
|
@ -1,132 +1,120 @@
|
||||||
AWSTemplateFormatVersion: '2010-09-09'
|
AWSTemplateFormatVersion: 2010-09-09
|
||||||
Description: AWS Fargate cluster that can span public and private subnets. Supports
|
Description: >-
|
||||||
public facing load balancers, private internal load balancers, and
|
AWS Fargate cluster that can span public and private subnets. Supports public
|
||||||
both internal and external service discovery namespaces.
|
facing load balancers, private internal load balancers, and both internal and
|
||||||
|
external service discovery namespaces.
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
||||||
EnvironmentName:
|
EnvironmentName:
|
||||||
Type: String
|
Type: String
|
||||||
Default: development
|
Default: development
|
||||||
Description: "Your deployment environment: DEV, QA , PROD"
|
Description: 'Your deployment environment: DEV, QA , PROD'
|
||||||
|
|
||||||
ServiceName:
|
ServiceName:
|
||||||
Type: String
|
Type: String
|
||||||
Default: example
|
Default: example
|
||||||
Description: A name for the service
|
Description: A name for the service
|
||||||
|
|
||||||
ImageUrl:
|
ImageUrl:
|
||||||
Type: String
|
Type: String
|
||||||
Default: nginx
|
Default: nginx
|
||||||
Description: The url of a docker image that contains the application process that
|
Description: >-
|
||||||
will handle the traffic for this service
|
The url of a docker image that contains the application process that will
|
||||||
|
handle the traffic for this service
|
||||||
ContainerPort:
|
ContainerPort:
|
||||||
Type: Number
|
Type: Number
|
||||||
Default: 80
|
Default: 80
|
||||||
Description: What port number the application inside the docker container is binding to
|
Description: What port number the application inside the docker container is binding to
|
||||||
|
|
||||||
ContainerCpu:
|
ContainerCpu:
|
||||||
Type: Number
|
Type: Number
|
||||||
Default: 256
|
Default: 256
|
||||||
Description: How much CPU to give the container. 1024 is 1 CPU
|
Description: How much CPU to give the container. 1024 is 1 CPU
|
||||||
|
|
||||||
ContainerMemory:
|
ContainerMemory:
|
||||||
Type: Number
|
Type: Number
|
||||||
Default: 512
|
Default: 512
|
||||||
Description: How much memory in megabytes to give the container
|
Description: How much memory in megabytes to give the container
|
||||||
|
|
||||||
Prefix:
|
Prefix:
|
||||||
Type: String
|
Type: String
|
||||||
Default: "test"
|
Default: test
|
||||||
|
|
||||||
Role:
|
Role:
|
||||||
Type: String
|
Type: String
|
||||||
Default: ""
|
Default: ''
|
||||||
Description: (Optional) An IAM role to give the service's containers if the code within needs to
|
Description: >-
|
||||||
access other AWS resources like S3 buckets, DynamoDB tables, etc
|
(Optional) An IAM role to give the service's containers if the code within
|
||||||
|
needs to access other AWS resources like S3 buckets, DynamoDB tables, etc
|
||||||
EFSMountPath:
|
EFSMountPath:
|
||||||
Type: String
|
Type: String
|
||||||
Default: "/usr/share/nginx/html"
|
Default: /usr/share/nginx/html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Mappings:
|
Mappings:
|
||||||
# Hard values for the subnet masks. These masks define
|
|
||||||
# the range of internal IP addresses that can be assigned.
|
|
||||||
# The VPC can have all IP's from 10.0.0.0 to 10.0.255.255
|
|
||||||
# There are four subnets which cover the ranges:
|
|
||||||
#
|
|
||||||
# 10.0.0.0 - 10.0.0.255
|
|
||||||
# 10.0.1.0 - 10.0.1.255
|
|
||||||
# 10.0.2.0 - 10.0.2.255
|
|
||||||
# 10.0.3.0 - 10.0.3.255
|
|
||||||
|
|
||||||
SubnetConfig:
|
SubnetConfig:
|
||||||
VPC:
|
VPC:
|
||||||
CIDR: '10.0.0.0/16'
|
CIDR: 10.0.0.0/16
|
||||||
PublicOne:
|
PublicOne:
|
||||||
CIDR: '10.0.0.0/24'
|
CIDR: 10.0.0.0/24
|
||||||
PublicTwo:
|
PublicTwo:
|
||||||
CIDR: '10.0.1.0/24'
|
CIDR: 10.0.1.0/24
|
||||||
# A log group for storing the stdout logs from this service's containers
|
|
||||||
Conditions:
|
Conditions:
|
||||||
HasCustomRole: !Not [ !Equals [!Ref 'Role', ''] ]
|
HasCustomRole: !Not
|
||||||
|
- !Equals
|
||||||
|
- Ref: Role
|
||||||
|
- ''
|
||||||
Resources:
|
Resources:
|
||||||
|
|
||||||
|
|
||||||
LogGroup:
|
LogGroup:
|
||||||
Type: AWS::Logs::LogGroup
|
Type: 'AWS::Logs::LogGroup'
|
||||||
Properties:
|
Properties:
|
||||||
LogGroupName: !Ref 'ServiceName'
|
LogGroupName: !Ref ServiceName
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
SubscriptionFilter:
|
SubscriptionFilter:
|
||||||
Type: AWS::Logs::SubscriptionFilter
|
Type: 'AWS::Logs::SubscriptionFilter'
|
||||||
Properties:
|
Properties:
|
||||||
FilterPattern: ''
|
FilterPattern: ''
|
||||||
RoleArn:
|
RoleArn:
|
||||||
Fn::ImportValue: !Sub ${EnvironmentName}:CloudWatchIAMRole
|
'Fn::ImportValue': !Sub '${EnvironmentName}:CloudWatchIAMRole'
|
||||||
LogGroupName: !Ref 'ServiceName'
|
LogGroupName: !Ref ServiceName
|
||||||
DestinationArn:
|
DestinationArn:
|
||||||
Fn::GetAtt:
|
'Fn::GetAtt':
|
||||||
- "KinesisStream"
|
- KinesisStream
|
||||||
- "Arn"
|
- Arn
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
DependsOn:
|
||||||
|
- LogGroup
|
||||||
|
- KinesisStream
|
||||||
KinesisStream:
|
KinesisStream:
|
||||||
Type: AWS::Kinesis::Stream
|
Type: 'AWS::Kinesis::Stream'
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Ref 'ServiceName'
|
Name: !Ref ServiceName
|
||||||
ShardCount: 1
|
ShardCount: 1
|
||||||
# The task definition. This is a simple metadata description of what
|
Metadata:
|
||||||
# container to run, and what resource requirements it has.
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
TaskDefinition:
|
TaskDefinition:
|
||||||
Type: AWS::ECS::TaskDefinition
|
Type: 'AWS::ECS::TaskDefinition'
|
||||||
Properties:
|
Properties:
|
||||||
Family: !Ref 'ServiceName'
|
Family: !Ref ServiceName
|
||||||
Cpu: !Ref 'ContainerCpu'
|
Cpu: !Ref ContainerCpu
|
||||||
Memory: !Ref 'ContainerMemory'
|
Memory: !Ref ContainerMemory
|
||||||
NetworkMode: awsvpc
|
NetworkMode: awsvpc
|
||||||
Volumes:
|
Volumes:
|
||||||
- Name: efs-data
|
- Name: efs-data
|
||||||
EFSVolumeConfiguration:
|
EFSVolumeConfiguration:
|
||||||
FilesystemId:
|
FilesystemId:
|
||||||
Fn::ImportValue: !Sub ${EnvironmentName}:EfsFileStorageId
|
'Fn::ImportValue': !Sub '${EnvironmentName}:EfsFileStorageId'
|
||||||
TransitEncryption: ENABLED
|
TransitEncryption: ENABLED
|
||||||
RequiresCompatibilities:
|
RequiresCompatibilities:
|
||||||
- FARGATE
|
- FARGATE
|
||||||
ExecutionRoleArn:
|
ExecutionRoleArn:
|
||||||
Fn::ImportValue: !Sub ${EnvironmentName}:ECSTaskExecutionRole
|
'Fn::ImportValue': !Sub '${EnvironmentName}:ECSTaskExecutionRole'
|
||||||
TaskRoleArn:
|
TaskRoleArn:
|
||||||
Fn::If:
|
'Fn::If':
|
||||||
- 'HasCustomRole'
|
- HasCustomRole
|
||||||
- !Ref 'Role'
|
- !Ref Role
|
||||||
- !Ref "AWS::NoValue"
|
- !Ref 'AWS::NoValue'
|
||||||
ContainerDefinitions:
|
ContainerDefinitions:
|
||||||
- Name: !Ref 'ServiceName'
|
- Name: !Ref ServiceName
|
||||||
Cpu: !Ref 'ContainerCpu'
|
Cpu: !Ref ContainerCpu
|
||||||
Memory: !Ref 'ContainerMemory'
|
Memory: !Ref ContainerMemory
|
||||||
Image: !Ref 'ImageUrl'
|
Image: !Ref ImageUrl
|
||||||
Environment:
|
Environment:
|
||||||
- Name: ALLOW_EMPTY_PASSWORD
|
- Name: ALLOW_EMPTY_PASSWORD
|
||||||
Value: 'yes'
|
Value: 'yes'
|
||||||
|
|
@ -135,8 +123,74 @@ Resources:
|
||||||
ContainerPath: !Ref EFSMountPath
|
ContainerPath: !Ref EFSMountPath
|
||||||
ReadOnly: false
|
ReadOnly: false
|
||||||
LogConfiguration:
|
LogConfiguration:
|
||||||
LogDriver: 'awslogs'
|
LogDriver: awslogs
|
||||||
Options:
|
Options:
|
||||||
awslogs-group: !Ref 'ServiceName'
|
awslogs-group: !Ref ServiceName
|
||||||
awslogs-region: !Ref 'AWS::Region'
|
awslogs-region: !Ref 'AWS::Region'
|
||||||
awslogs-stream-prefix: !Ref 'ServiceName'
|
awslogs-stream-prefix: !Ref ServiceName
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
id: dabb0116-abe0-48a6-a8af-cf9111c879a5
|
||||||
|
DependsOn:
|
||||||
|
- LogGroup
|
||||||
|
Metadata:
|
||||||
|
'AWS::CloudFormation::Designer':
|
||||||
|
dabb0116-abe0-48a6-a8af-cf9111c879a5:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 270
|
||||||
|
'y': 90
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
dependson:
|
||||||
|
- aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
c6f18447-b879-4696-8873-f981b2cedd2b:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 270
|
||||||
|
'y': 210
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
7f809e91-9e5d-4678-98c1-c5085956c480:
|
||||||
|
size:
|
||||||
|
width: 60
|
||||||
|
height: 60
|
||||||
|
position:
|
||||||
|
x: 60
|
||||||
|
'y': 300
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
dependson:
|
||||||
|
- aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
- c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
|
aece53ae-b82d-4267-bc16-ed964b05db27:
|
||||||
|
size:
|
||||||
|
width: 150
|
||||||
|
height: 150
|
||||||
|
position:
|
||||||
|
x: 60
|
||||||
|
'y': 90
|
||||||
|
z: 1
|
||||||
|
embeds: []
|
||||||
|
4d2da56c-3643-46b8-aaee-e46e19f95fcc:
|
||||||
|
source:
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
target:
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
z: 11
|
||||||
|
14eb957b-f094-4653-93c4-77b2f851953c:
|
||||||
|
source:
|
||||||
|
id: 7f809e91-9e5d-4678-98c1-c5085956c480
|
||||||
|
target:
|
||||||
|
id: c6f18447-b879-4696-8873-f981b2cedd2b
|
||||||
|
z: 12
|
||||||
|
85c57444-e5bb-4230-bc85-e545cd4558f6:
|
||||||
|
source:
|
||||||
|
id: dabb0116-abe0-48a6-a8af-cf9111c879a5
|
||||||
|
target:
|
||||||
|
id: aece53ae-b82d-4267-bc16-ed964b05db27
|
||||||
|
z: 13
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue