Skip to content

Instantly share code, notes, and snippets.

@naoto-ogawa
Created October 26, 2019 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naoto-ogawa/cb9cb73573947f4da5b9bfb1cf11c30e to your computer and use it in GitHub Desktop.
Save naoto-ogawa/cb9cb73573947f4da5b9bfb1cf11c30e to your computer and use it in GitHub Desktop.
A generated cloudformation file
Resources:
MyVPCAFB07A31:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsHostnames: true
EnableDnsSupport: true
InstanceTenancy: default
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/Resource
MyVPCPublicSubnet1Subnet0C75866A:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.0.0/18
VpcId:
Ref: MyVPCAFB07A31
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: ""
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet1
- Key: aws-cdk:subnet-name
Value: Public
- Key: aws-cdk:subnet-type
Value: Public
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/Subnet
MyVPCPublicSubnet1RouteTable538A9511:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVPCAFB07A31
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet1
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/RouteTable
MyVPCPublicSubnet1RouteTableAssociation8A950D8E:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVPCPublicSubnet1RouteTable538A9511
SubnetId:
Ref: MyVPCPublicSubnet1Subnet0C75866A
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/RouteTableAssociation
MyVPCPublicSubnet1DefaultRouteAF81AA9B:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVPCPublicSubnet1RouteTable538A9511
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: MyVPCIGW30AB6DD6
DependsOn:
- MyVPCVPCGWE6F260E1
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/DefaultRoute
MyVPCPublicSubnet1EIP5EB6147D:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/EIP
MyVPCPublicSubnet1NATGateway838228A5:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt:
- MyVPCPublicSubnet1EIP5EB6147D
- AllocationId
SubnetId:
Ref: MyVPCPublicSubnet1Subnet0C75866A
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet1
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet1/NATGateway
MyVPCPublicSubnet2Subnet4DDFF14C:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.64.0/18
VpcId:
Ref: MyVPCAFB07A31
AvailabilityZone:
Fn::Select:
- 1
- Fn::GetAZs: ""
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet2
- Key: aws-cdk:subnet-name
Value: Public
- Key: aws-cdk:subnet-type
Value: Public
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/Subnet
MyVPCPublicSubnet2RouteTableA6A1CD3D:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVPCAFB07A31
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet2
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/RouteTable
MyVPCPublicSubnet2RouteTableAssociationF22D63CA:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVPCPublicSubnet2RouteTableA6A1CD3D
SubnetId:
Ref: MyVPCPublicSubnet2Subnet4DDFF14C
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/RouteTableAssociation
MyVPCPublicSubnet2DefaultRoute24460202:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVPCPublicSubnet2RouteTableA6A1CD3D
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: MyVPCIGW30AB6DD6
DependsOn:
- MyVPCVPCGWE6F260E1
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/DefaultRoute
MyVPCPublicSubnet2EIP6F364C5D:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/EIP
MyVPCPublicSubnet2NATGateway4D6E78B8:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt:
- MyVPCPublicSubnet2EIP6F364C5D
- AllocationId
SubnetId:
Ref: MyVPCPublicSubnet2Subnet4DDFF14C
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PublicSubnet2
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PublicSubnet2/NATGateway
MyVPCPrivateSubnet1Subnet641543F4:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.128.0/18
VpcId:
Ref: MyVPCAFB07A31
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: ""
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PrivateSubnet1
- Key: aws-cdk:subnet-name
Value: Private
- Key: aws-cdk:subnet-type
Value: Private
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet1/Subnet
MyVPCPrivateSubnet1RouteTable133BD901:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVPCAFB07A31
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PrivateSubnet1
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet1/RouteTable
MyVPCPrivateSubnet1RouteTableAssociation85DFBFBB:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVPCPrivateSubnet1RouteTable133BD901
SubnetId:
Ref: MyVPCPrivateSubnet1Subnet641543F4
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet1/RouteTableAssociation
MyVPCPrivateSubnet1DefaultRouteA8EE6636:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVPCPrivateSubnet1RouteTable133BD901
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: MyVPCPublicSubnet1NATGateway838228A5
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet1/DefaultRoute
MyVPCPrivateSubnet2SubnetA420D3F0:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.192.0/18
VpcId:
Ref: MyVPCAFB07A31
AvailabilityZone:
Fn::Select:
- 1
- Fn::GetAZs: ""
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PrivateSubnet2
- Key: aws-cdk:subnet-name
Value: Private
- Key: aws-cdk:subnet-type
Value: Private
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet2/Subnet
MyVPCPrivateSubnet2RouteTableDF3CB76C:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVPCAFB07A31
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC/PrivateSubnet2
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet2/RouteTable
MyVPCPrivateSubnet2RouteTableAssociationC373B6FE:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVPCPrivateSubnet2RouteTableDF3CB76C
SubnetId:
Ref: MyVPCPrivateSubnet2SubnetA420D3F0
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet2/RouteTableAssociation
MyVPCPrivateSubnet2DefaultRoute37F90B5D:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVPCPrivateSubnet2RouteTableDF3CB76C
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: MyVPCPublicSubnet2NATGateway4D6E78B8
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/PrivateSubnet2/DefaultRoute
MyVPCIGW30AB6DD6:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: Cdk01Stack/MyVPC
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/IGW
MyVPCVPCGWE6F260E1:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
Ref: MyVPCAFB07A31
InternetGatewayId:
Ref: MyVPCIGW30AB6DD6
Metadata:
aws:cdk:path: Cdk01Stack/MyVPC/VPCGW
MyCluster4C1BA579:
Type: AWS::ECS::Cluster
Metadata:
aws:cdk:path: Cdk01Stack/MyCluster/Resource
MyQueueProcessingServiceEcsProcessingQueue164FB44C:
Type: AWS::SQS::Queue
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/EcsProcessingQueue/Resource
MyQueueProcessingServiceQueueProcessingTaskDefTaskRole1E3B42D5:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Version: "2012-10-17"
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/TaskRole/Resource
MyQueueProcessingServiceQueueProcessingTaskDefC61C1980:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Environment:
- Name: QUEUE_NAME
Value:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- QueueName
Essential: true
Image:
Fn::Join:
- ""
- - Ref: AWS::AccountId
- .dkr.ecr.
- Ref: AWS::Region
- "."
- Ref: AWS::URLSuffix
- /
- Fn::Select:
- 0
- Fn::Split:
- "@sha256:"
- Ref: AssetParametersa5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8ImageNameEA7DDF8F
- "@sha256:"
- Fn::Select:
- 1
- Fn::Split:
- "@sha256:"
- Ref: AssetParametersa5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8ImageNameEA7DDF8F
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group:
Ref: MyQueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupEF0D3264
awslogs-stream-prefix: MyQueueProcessingService
awslogs-region:
Ref: AWS::Region
Name: QueueProcessingContainer
Cpu: "256"
ExecutionRoleArn:
Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingTaskDefExecutionRoleF723C419
- Arn
Family: Cdk01StackMyQueueProcessingServiceQueueProcessingTaskDef2DB44405
Memory: "512"
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn:
Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingTaskDefTaskRole1E3B42D5
- Arn
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/Resource
MyQueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerAssetImageAdoptRepository0598246B:
Type: Custom::ECRAdoptedRepository
Properties:
ServiceToken:
Fn::GetAtt:
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c52BE89E9
- Arn
RepositoryName:
Fn::Select:
- 0
- Fn::Split:
- "@sha256:"
- Ref: AssetParametersa5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8ImageNameEA7DDF8F
DependsOn:
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/AssetImage/AdoptRepository/Resource/Default
MyQueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupEF0D3264:
Type: AWS::Logs::LogGroup
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/QueueProcessingContainer/LogGroup/Resource
MyQueueProcessingServiceQueueProcessingTaskDefExecutionRoleF723C419:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Version: "2012-10-17"
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/ExecutionRole/Resource
MyQueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicy7F86E179:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
Effect: Allow
Resource:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":ecr:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- :repository/
- Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerAssetImageAdoptRepository0598246B
- RepositoryName
- Action: ecr:GetAuthorizationToken
Effect: Allow
Resource: "*"
- Action:
- logs:CreateLogStream
- logs:PutLogEvents
Effect: Allow
Resource:
Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingTaskDefQueueProcessingContainerLogGroupEF0D3264
- Arn
Version: "2012-10-17"
PolicyName: MyQueueProcessingServiceQueueProcessingTaskDefExecutionRoleDefaultPolicy7F86E179
Roles:
- Ref: MyQueueProcessingServiceQueueProcessingTaskDefExecutionRoleF723C419
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingTaskDef/ExecutionRole/DefaultPolicy/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceF3499FE2:
Type: AWS::ECS::Service
Properties:
TaskDefinition:
Ref: MyQueueProcessingServiceQueueProcessingTaskDefC61C1980
Cluster:
Ref: MyCluster4C1BA579
DeploymentConfiguration:
MaximumPercent: 200
MinimumHealthyPercent: 50
DesiredCount: 1
EnableECSManagedTags: false
LaunchType: FARGATE
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: DISABLED
SecurityGroups:
- Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingFargateServiceSecurityGroup32481434
- GroupId
Subnets:
- Ref: MyVPCPrivateSubnet1Subnet641543F4
- Ref: MyVPCPrivateSubnet2SubnetA420D3F0
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/Service
MyQueueProcessingServiceQueueProcessingFargateServiceSecurityGroup32481434:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/SecurityGroup
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: Allow all outbound traffic by default
IpProtocol: "-1"
VpcId:
Ref: MyVPCAFB07A31
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/SecurityGroup/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetEE823726:
Type: AWS::ApplicationAutoScaling::ScalableTarget
Properties:
MaxCapacity: 2
MinCapacity: 1
ResourceId:
Fn::Join:
- ""
- - service/
- Ref: MyCluster4C1BA579
- /
- Fn::GetAtt:
- MyQueueProcessingServiceQueueProcessingFargateServiceF3499FE2
- Name
RoleARN:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":iam::"
- Ref: AWS::AccountId
- :role/aws-service-role/ecs.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_ECSService
ScalableDimension: ecs:service:DesiredCount
ServiceNamespace: ecs
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScaling33648939:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: Cdk01StackMyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetCpuScalingEC4D0554
PolicyType: TargetTrackingScaling
ScalingTargetId:
Ref: MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetEE823726
TargetTrackingScalingPolicyConfiguration:
PredefinedMetricSpecification:
PredefinedMetricType: ECSServiceAverageCPUUtilization
TargetValue: 50
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/CpuScaling/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicyFF69C56A:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: Cdk01StackMyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicyA129415F
PolicyType: StepScaling
ScalingTargetId:
Ref: MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetEE823726
StepScalingPolicyConfiguration:
AdjustmentType: ChangeInCapacity
MetricAggregationType: Maximum
StepAdjustments:
- MetricIntervalUpperBound: 0
ScalingAdjustment: -1
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerPolicy/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarmA6FF335B:
Type: AWS::CloudWatch::Alarm
Properties:
ComparisonOperator: LessThanOrEqualToThreshold
EvaluationPeriods: 1
AlarmActions:
- Ref: MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingLowerPolicyFF69C56A
AlarmDescription: Lower threshold scaling alarm
Dimensions:
- Name: QueueName
Value:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- QueueName
MetricName: ApproximateNumberOfMessagesVisible
Namespace: AWS/SQS
Period: 60
Statistic: Maximum
Threshold: 0
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicyAAF14E47:
Type: AWS::ApplicationAutoScaling::ScalingPolicy
Properties:
PolicyName: Cdk01StackMyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicyE51757A1
PolicyType: StepScaling
ScalingTargetId:
Ref: MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetEE823726
StepScalingPolicyConfiguration:
AdjustmentType: ChangeInCapacity
MetricAggregationType: Maximum
StepAdjustments:
- MetricIntervalLowerBound: 0
MetricIntervalUpperBound: 400
ScalingAdjustment: 1
- MetricIntervalLowerBound: 400
ScalingAdjustment: 5
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperPolicy/Resource
MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarmE8FD6A8E:
Type: AWS::CloudWatch::Alarm
Properties:
ComparisonOperator: GreaterThanOrEqualToThreshold
EvaluationPeriods: 1
AlarmActions:
- Ref: MyQueueProcessingServiceQueueProcessingFargateServiceTaskCountTargetQueueMessagesVisibleScalingUpperPolicyAAF14E47
AlarmDescription: Upper threshold scaling alarm
Dimensions:
- Name: QueueName
Value:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- QueueName
MetricName: ApproximateNumberOfMessagesVisible
Namespace: AWS/SQS
Period: 60
Statistic: Maximum
Threshold: 100
Metadata:
aws:cdk:path: Cdk01Stack/MyQueueProcessingService/QueueProcessingFargateService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm/Resource
AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: Cdk01Stack/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/ServiceRole/Resource
AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- ecr:GetRepositoryPolicy
- ecr:SetRepositoryPolicy
- ecr:DeleteRepository
- ecr:ListImages
- ecr:BatchDeleteImage
Effect: Allow
Resource:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":ecr:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- :repository/
- Fn::Select:
- 0
- Fn::Split:
- "@sha256:"
- Ref: AssetParametersa5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8ImageNameEA7DDF8F
Version: "2012-10-17"
PolicyName: AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C
Roles:
- Ref: AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17
Metadata:
aws:cdk:path: Cdk01Stack/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/ServiceRole/DefaultPolicy/Resource
AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c52BE89E9:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Ref: AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7S3Bucket7CBBD48C
S3Key:
Fn::Join:
- ""
- - Fn::Select:
- 0
- Fn::Split:
- "||"
- Ref: AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7S3VersionKey87E3D057
- Fn::Select:
- 1
- Fn::Split:
- "||"
- Ref: AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7S3VersionKey87E3D057
Handler: handler.handler
Role:
Fn::GetAtt:
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17
- Arn
Runtime: nodejs8.10
Timeout: 300
DependsOn:
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C
- AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17
Metadata:
aws:cdk:path: Cdk01Stack/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Resource
aws:asset:path: asset.a65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7
aws:asset:property: Code
MyFrontendFunctionServiceRoleA5C5FC0C:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendFunction/ServiceRole/Resource
MyFrontendFunctionServiceRoleDefaultPolicy1EC8A7AF:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- sqs:SendMessage
- sqs:GetQueueAttributes
- sqs:GetQueueUrl
Effect: Allow
Resource:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- Arn
Version: "2012-10-17"
PolicyName: MyFrontendFunctionServiceRoleDefaultPolicy1EC8A7AF
Roles:
- Ref: MyFrontendFunctionServiceRoleA5C5FC0C
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendFunction/ServiceRole/DefaultPolicy/Resource
MyFrontendFunctionDE87D512:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Ref: AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0S3Bucket5EA66AEF
S3Key:
Fn::Join:
- ""
- - Fn::Select:
- 0
- Fn::Split:
- "||"
- Ref: AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0S3VersionKeyD171B821
- Fn::Select:
- 1
- Fn::Split:
- "||"
- Ref: AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0S3VersionKeyD171B821
Handler: index.handler
Role:
Fn::GetAtt:
- MyFrontendFunctionServiceRoleA5C5FC0C
- Arn
Runtime: nodejs10.x
Environment:
Variables:
QUEUE_NAME:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- QueueName
DependsOn:
- MyFrontendFunctionServiceRoleDefaultPolicy1EC8A7AF
- MyFrontendFunctionServiceRoleA5C5FC0C
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendFunction/Resource
aws:asset:path: asset.1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0
aws:asset:property: Code
MyFrontendApi0C0784FC:
Type: AWS::ApiGateway::RestApi
Properties:
Name: MyFrontendApi
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Resource
MyFrontendApiDeployment850B0446cf7b21bf5f3875531e1a4375c7258750:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: MyFrontendApi0C0784FC
Description: Automatically created by the RestApi construct
DependsOn:
- MyFrontendApiproxyANYC88F3851
- MyFrontendApiproxy5A6FDCD6
- MyFrontendApiANYC736E74B
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Deployment/Resource
MyFrontendApiDeploymentStageprod7467DFDB:
Type: AWS::ApiGateway::Stage
Properties:
RestApiId:
Ref: MyFrontendApi0C0784FC
DeploymentId:
Ref: MyFrontendApiDeployment850B0446cf7b21bf5f3875531e1a4375c7258750
StageName: prod
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/DeploymentStage.prod/Resource
MyFrontendApiCloudWatchRole24EE7971:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: apigateway.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/CloudWatchRole/Resource
MyFrontendApiAccount551D3BDA:
Type: AWS::ApiGateway::Account
Properties:
CloudWatchRoleArn:
Fn::GetAtt:
- MyFrontendApiCloudWatchRole24EE7971
- Arn
DependsOn:
- MyFrontendApi0C0784FC
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Account
MyFrontendApiproxy5A6FDCD6:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Fn::GetAtt:
- MyFrontendApi0C0784FC
- RootResourceId
PathPart: "{proxy+}"
RestApiId:
Ref: MyFrontendApi0C0784FC
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/{proxy+}/Resource
MyFrontendApiproxyANYApiPermissionCdk01StackMyFrontendApi96FC2D4AANYproxy7021C45E:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: MyFrontendApi0C0784FC
- /
- Ref: MyFrontendApiDeploymentStageprod7467DFDB
- /*/{proxy+}
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/{proxy+}/ANY/ApiPermission.Cdk01StackMyFrontendApi96FC2D4A.ANY..{proxy+}
MyFrontendApiproxyANYApiPermissionTestCdk01StackMyFrontendApi96FC2D4AANYproxyA09427CC:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: MyFrontendApi0C0784FC
- /test-invoke-stage/*/{proxy+}
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/{proxy+}/ANY/ApiPermission.Test.Cdk01StackMyFrontendApi96FC2D4A.ANY..{proxy+}
MyFrontendApiproxyANYC88F3851:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: ANY
ResourceId:
Ref: MyFrontendApiproxy5A6FDCD6
RestApiId:
Ref: MyFrontendApi0C0784FC
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":apigateway:"
- Ref: AWS::Region
- :lambda:path/2015-03-31/functions/
- Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
- /invocations
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/{proxy+}/ANY/Resource
MyFrontendApiANYApiPermissionCdk01StackMyFrontendApi96FC2D4AANY22ABE970:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: MyFrontendApi0C0784FC
- /
- Ref: MyFrontendApiDeploymentStageprod7467DFDB
- /*/
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/ANY/ApiPermission.Cdk01StackMyFrontendApi96FC2D4A.ANY..
MyFrontendApiANYApiPermissionTestCdk01StackMyFrontendApi96FC2D4AANY142EE8BC:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: MyFrontendApi0C0784FC
- /test-invoke-stage/*/
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/ANY/ApiPermission.Test.Cdk01StackMyFrontendApi96FC2D4A.ANY..
MyFrontendApiANYC736E74B:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: ANY
ResourceId:
Fn::GetAtt:
- MyFrontendApi0C0784FC
- RootResourceId
RestApiId:
Ref: MyFrontendApi0C0784FC
AuthorizationType: NONE
Integration:
IntegrationHttpMethod: POST
Type: AWS_PROXY
Uri:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":apigateway:"
- Ref: AWS::Region
- :lambda:path/2015-03-31/functions/
- Fn::GetAtt:
- MyFrontendFunctionDE87D512
- Arn
- /invocations
Metadata:
aws:cdk:path: Cdk01Stack/MyFrontendApi/Default/ANY/Resource
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Modules: aws-cdk=1.14.0,@aws-cdk/assets=1.14.0,@aws-cdk/aws-apigateway=1.14.0,@aws-cdk/aws-applicationautoscaling=1.14.0,@aws-cdk/aws-autoscaling=1.14.0,@aws-cdk/aws-autoscaling-common=1.14.0,@aws-cdk/aws-autoscaling-hooktargets=1.14.0,@aws-cdk/aws-certificatemanager=1.14.0,@aws-cdk/aws-cloudformation=1.14.0,@aws-cdk/aws-cloudwatch=1.14.0,@aws-cdk/aws-ec2=1.14.0,@aws-cdk/aws-ecr=1.14.0,@aws-cdk/aws-ecr-assets=1.14.0,@aws-cdk/aws-ecs=1.14.0,@aws-cdk/aws-ecs-patterns=1.14.0,@aws-cdk/aws-elasticloadbalancingv2=1.14.0,@aws-cdk/aws-events=1.14.0,@aws-cdk/aws-events-targets=1.14.0,@aws-cdk/aws-iam=1.14.0,@aws-cdk/aws-kms=1.14.0,@aws-cdk/aws-lambda=1.14.0,@aws-cdk/aws-logs=1.14.0,@aws-cdk/aws-route53=1.14.0,@aws-cdk/aws-route53-targets=1.14.0,@aws-cdk/aws-s3=1.14.0,@aws-cdk/aws-s3-assets=1.14.0,@aws-cdk/aws-servicediscovery=1.14.0,@aws-cdk/aws-sns=1.14.0,@aws-cdk/aws-sns-subscriptions=1.14.0,@aws-cdk/aws-sqs=1.14.0,@aws-cdk/aws-ssm=1.14.0,@aws-cdk/core=1.14.0,@aws-cdk/cx-api=1.14.0,@aws-cdk/region-info=1.14.0,jsii-runtime=node.js/v10.16.0
Condition: CDKMetadataAvailable
Outputs:
MyQueueProcessingServiceSQSQueueCB188552:
Value:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- QueueName
MyQueueProcessingServiceSQSQueueArnC96507D6:
Value:
Fn::GetAtt:
- MyQueueProcessingServiceEcsProcessingQueue164FB44C
- Arn
MyFrontendApiEndpoint08C7D745:
Value:
Fn::Join:
- ""
- - https://
- Ref: MyFrontendApi0C0784FC
- .execute-api.
- Ref: AWS::Region
- "."
- Ref: AWS::URLSuffix
- /
- Ref: MyFrontendApiDeploymentStageprod7467DFDB
- /
Parameters:
AssetParametersa5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8ImageNameEA7DDF8F:
Type: String
Description: ECR repository name and tag for asset "a5671030823ed06a8f9dae8c58ed287890a1f8f142c62aaba9808e007d84abd8"
AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7S3Bucket7CBBD48C:
Type: String
Description: S3 bucket for asset "a65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7"
AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7S3VersionKey87E3D057:
Type: String
Description: S3 key for asset version "a65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7"
AssetParametersa65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7ArtifactHash3E217B68:
Type: String
Description: Artifact hash for asset "a65ac4beaa2b5a7b20eebf3b7c5c1c886b71428afa377e02dab0d10ab3be57e7"
AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0S3Bucket5EA66AEF:
Type: String
Description: S3 bucket for asset "1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0"
AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0S3VersionKeyD171B821:
Type: String
Description: S3 key for asset version "1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0"
AssetParameters1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0ArtifactHash4A934180:
Type: String
Description: Artifact hash for asset "1ebc9d3ac2033816c4abb63e4afd69d350b4aba8704cc9236b82ea520b74f4b0"
Conditions:
CDKMetadataAvailable:
Fn::Or:
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- ap-east-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-2
- Fn::Equals:
- Ref: AWS::Region
- ap-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-2
- Fn::Equals:
- Ref: AWS::Region
- ca-central-1
- Fn::Equals:
- Ref: AWS::Region
- cn-north-1
- Fn::Equals:
- Ref: AWS::Region
- cn-northwest-1
- Fn::Equals:
- Ref: AWS::Region
- eu-central-1
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- eu-north-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-2
- Fn::Equals:
- Ref: AWS::Region
- eu-west-3
- Fn::Equals:
- Ref: AWS::Region
- me-south-1
- Fn::Equals:
- Ref: AWS::Region
- sa-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-2
- Fn::Equals:
- Ref: AWS::Region
- us-west-1
- Fn::Equals:
- Ref: AWS::Region
- us-west-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment