-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
davidchristiansen/LoadBalancedFargateService-ContainerNameAndRoleOver…
…rides Implemenation of execution tests, task role and container name overrides + tests
1 parent
3f7a0ad
commit b0fa386
Showing
4 changed files
with
854 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
704 changes: 704 additions & 0 deletions
704
packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,704 @@ | ||
{ | ||
"Resources": { | ||
"Vpc8378EB38": { | ||
"Type": "AWS::EC2::VPC", | ||
"Properties": { | ||
"CidrBlock": "10.0.0.0/16", | ||
"EnableDnsHostnames": true, | ||
"EnableDnsSupport": true, | ||
"InstanceTenancy": "default", | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet1Subnet5C2D37C4": { | ||
"Type": "AWS::EC2::Subnet", | ||
"Properties": { | ||
"CidrBlock": "10.0.0.0/18", | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"AvailabilityZone": "test-region-1a", | ||
"MapPublicIpOnLaunch": true, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet1" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-name", | ||
"Value": "Public" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-type", | ||
"Value": "Public" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet1RouteTable6C95E38E": { | ||
"Type": "AWS::EC2::RouteTable", | ||
"Properties": { | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet1" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet1RouteTableAssociation97140677": { | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPublicSubnet1RouteTable6C95E38E" | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPublicSubnet1Subnet5C2D37C4" | ||
} | ||
} | ||
}, | ||
"VpcPublicSubnet1DefaultRoute3DA9E72A": { | ||
"Type": "AWS::EC2::Route", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPublicSubnet1RouteTable6C95E38E" | ||
}, | ||
"DestinationCidrBlock": "0.0.0.0/0", | ||
"GatewayId": { | ||
"Ref": "VpcIGWD7BA715C" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"VpcVPCGWBF912B6E" | ||
] | ||
}, | ||
"VpcPublicSubnet1EIPD7E02669": { | ||
"Type": "AWS::EC2::EIP", | ||
"Properties": { | ||
"Domain": "vpc" | ||
} | ||
}, | ||
"VpcPublicSubnet1NATGateway4D7517AA": { | ||
"Type": "AWS::EC2::NatGateway", | ||
"Properties": { | ||
"AllocationId": { | ||
"Fn::GetAtt": [ | ||
"VpcPublicSubnet1EIPD7E02669", | ||
"AllocationId" | ||
] | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPublicSubnet1Subnet5C2D37C4" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet1" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet2Subnet691E08A3": { | ||
"Type": "AWS::EC2::Subnet", | ||
"Properties": { | ||
"CidrBlock": "10.0.64.0/18", | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"AvailabilityZone": "test-region-1b", | ||
"MapPublicIpOnLaunch": true, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet2" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-name", | ||
"Value": "Public" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-type", | ||
"Value": "Public" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet2RouteTable94F7E489": { | ||
"Type": "AWS::EC2::RouteTable", | ||
"Properties": { | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet2" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPublicSubnet2RouteTableAssociationDD5762D8": { | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPublicSubnet2RouteTable94F7E489" | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPublicSubnet2Subnet691E08A3" | ||
} | ||
} | ||
}, | ||
"VpcPublicSubnet2DefaultRoute97F91067": { | ||
"Type": "AWS::EC2::Route", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPublicSubnet2RouteTable94F7E489" | ||
}, | ||
"DestinationCidrBlock": "0.0.0.0/0", | ||
"GatewayId": { | ||
"Ref": "VpcIGWD7BA715C" | ||
} | ||
}, | ||
"DependsOn": [ | ||
"VpcVPCGWBF912B6E" | ||
] | ||
}, | ||
"VpcPublicSubnet2EIP3C605A87": { | ||
"Type": "AWS::EC2::EIP", | ||
"Properties": { | ||
"Domain": "vpc" | ||
} | ||
}, | ||
"VpcPublicSubnet2NATGateway9182C01D": { | ||
"Type": "AWS::EC2::NatGateway", | ||
"Properties": { | ||
"AllocationId": { | ||
"Fn::GetAtt": [ | ||
"VpcPublicSubnet2EIP3C605A87", | ||
"AllocationId" | ||
] | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPublicSubnet2Subnet691E08A3" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PublicSubnet2" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPrivateSubnet1Subnet536B997A": { | ||
"Type": "AWS::EC2::Subnet", | ||
"Properties": { | ||
"CidrBlock": "10.0.128.0/18", | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"AvailabilityZone": "test-region-1a", | ||
"MapPublicIpOnLaunch": false, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PrivateSubnet1" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-name", | ||
"Value": "Private" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-type", | ||
"Value": "Private" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPrivateSubnet1RouteTableB2C5B500": { | ||
"Type": "AWS::EC2::RouteTable", | ||
"Properties": { | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PrivateSubnet1" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPrivateSubnet1RouteTableAssociation70C59FA6": { | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPrivateSubnet1RouteTableB2C5B500" | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPrivateSubnet1Subnet536B997A" | ||
} | ||
} | ||
}, | ||
"VpcPrivateSubnet1DefaultRouteBE02A9ED": { | ||
"Type": "AWS::EC2::Route", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPrivateSubnet1RouteTableB2C5B500" | ||
}, | ||
"DestinationCidrBlock": "0.0.0.0/0", | ||
"NatGatewayId": { | ||
"Ref": "VpcPublicSubnet1NATGateway4D7517AA" | ||
} | ||
} | ||
}, | ||
"VpcPrivateSubnet2Subnet3788AAA1": { | ||
"Type": "AWS::EC2::Subnet", | ||
"Properties": { | ||
"CidrBlock": "10.0.192.0/18", | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"AvailabilityZone": "test-region-1b", | ||
"MapPublicIpOnLaunch": false, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PrivateSubnet2" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-name", | ||
"Value": "Private" | ||
}, | ||
{ | ||
"Key": "aws-cdk:subnet-type", | ||
"Value": "Private" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPrivateSubnet2RouteTableA678073B": { | ||
"Type": "AWS::EC2::RouteTable", | ||
"Properties": { | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc/PrivateSubnet2" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcPrivateSubnet2RouteTableAssociationA89CAD56": { | ||
"Type": "AWS::EC2::SubnetRouteTableAssociation", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPrivateSubnet2RouteTableA678073B" | ||
}, | ||
"SubnetId": { | ||
"Ref": "VpcPrivateSubnet2Subnet3788AAA1" | ||
} | ||
} | ||
}, | ||
"VpcPrivateSubnet2DefaultRoute060D2087": { | ||
"Type": "AWS::EC2::Route", | ||
"Properties": { | ||
"RouteTableId": { | ||
"Ref": "VpcPrivateSubnet2RouteTableA678073B" | ||
}, | ||
"DestinationCidrBlock": "0.0.0.0/0", | ||
"NatGatewayId": { | ||
"Ref": "VpcPublicSubnet2NATGateway9182C01D" | ||
} | ||
} | ||
}, | ||
"VpcIGWD7BA715C": { | ||
"Type": "AWS::EC2::InternetGateway", | ||
"Properties": { | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "aws-ecs-integ/Vpc" | ||
} | ||
] | ||
} | ||
}, | ||
"VpcVPCGWBF912B6E": { | ||
"Type": "AWS::EC2::VPCGatewayAttachment", | ||
"Properties": { | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
}, | ||
"InternetGatewayId": { | ||
"Ref": "VpcIGWD7BA715C" | ||
} | ||
} | ||
}, | ||
"FargateCluster7CCD5F93": { | ||
"Type": "AWS::ECS::Cluster" | ||
}, | ||
"ExecutionRole605A040B": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"ecs.", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
} | ||
] | ||
] | ||
}, | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"ecs-tasks.", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
} | ||
] | ||
] | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"ExecutionRoleDefaultPolicyA5B92313": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents" | ||
], | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"L3LoggingLogGroupBD1F02DD", | ||
"Arn" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "ExecutionRoleDefaultPolicyA5B92313", | ||
"Roles": [ | ||
{ | ||
"Ref": "ExecutionRole605A040B" | ||
} | ||
] | ||
} | ||
}, | ||
"L3LB212FC0E0": { | ||
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", | ||
"Properties": { | ||
"LoadBalancerAttributes": [], | ||
"Scheme": "internet-facing", | ||
"SecurityGroups": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"L3LBSecurityGroupEDE61198", | ||
"GroupId" | ||
] | ||
} | ||
], | ||
"Subnets": [ | ||
{ | ||
"Ref": "VpcPublicSubnet1Subnet5C2D37C4" | ||
}, | ||
{ | ||
"Ref": "VpcPublicSubnet2Subnet691E08A3" | ||
} | ||
], | ||
"Type": "application" | ||
}, | ||
"DependsOn": [ | ||
"VpcPublicSubnet1DefaultRoute3DA9E72A", | ||
"VpcPublicSubnet2DefaultRoute97F91067" | ||
] | ||
}, | ||
"L3LBSecurityGroupEDE61198": { | ||
"Type": "AWS::EC2::SecurityGroup", | ||
"Properties": { | ||
"GroupDescription": "Automatically created Security Group for ELB awsecsintegL3LB6453BA0A", | ||
"SecurityGroupEgress": [], | ||
"SecurityGroupIngress": [ | ||
{ | ||
"CidrIp": "0.0.0.0/0", | ||
"Description": "Allow from anyone on port 80", | ||
"FromPort": 80, | ||
"IpProtocol": "tcp", | ||
"ToPort": 80 | ||
} | ||
], | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
} | ||
} | ||
}, | ||
"L3LBSecurityGrouptoawsecsintegL3ServiceSecurityGroup7B96C87F8094933E0A": { | ||
"Type": "AWS::EC2::SecurityGroupEgress", | ||
"Properties": { | ||
"GroupId": { | ||
"Fn::GetAtt": [ | ||
"L3LBSecurityGroupEDE61198", | ||
"GroupId" | ||
] | ||
}, | ||
"IpProtocol": "tcp", | ||
"Description": "Load balancer to target", | ||
"DestinationSecurityGroupId": { | ||
"Fn::GetAtt": [ | ||
"L3ServiceSecurityGroup677B0897", | ||
"GroupId" | ||
] | ||
}, | ||
"FromPort": 80, | ||
"ToPort": 80 | ||
} | ||
}, | ||
"L3LBPublicListener156FFC0F": { | ||
"Type": "AWS::ElasticLoadBalancingV2::Listener", | ||
"Properties": { | ||
"DefaultActions": [ | ||
{ | ||
"TargetGroupArn": { | ||
"Ref": "L3LBPublicListenerECSGroup648EEA11" | ||
}, | ||
"Type": "forward" | ||
} | ||
], | ||
"LoadBalancerArn": { | ||
"Ref": "L3LB212FC0E0" | ||
}, | ||
"Port": 80, | ||
"Protocol": "HTTP", | ||
"Certificates": [] | ||
} | ||
}, | ||
"L3LBPublicListenerECSGroup648EEA11": { | ||
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup", | ||
"Properties": { | ||
"Port": 80, | ||
"Protocol": "HTTP", | ||
"TargetGroupAttributes": [], | ||
"Targets": [], | ||
"TargetType": "ip", | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
} | ||
} | ||
}, | ||
"L3TaskDefTaskRole21C75D10": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"ecs-tasks.", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
} | ||
] | ||
] | ||
} | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
} | ||
} | ||
}, | ||
"L3TaskDef48D8ACB8": { | ||
"Type": "AWS::ECS::TaskDefinition", | ||
"Properties": { | ||
"ContainerDefinitions": [ | ||
{ | ||
"Essential": true, | ||
"Image": "amazon/amazon-ecs-sample", | ||
"Links": [], | ||
"LogConfiguration": { | ||
"LogDriver": "awslogs", | ||
"Options": { | ||
"awslogs-group": { | ||
"Ref": "L3LoggingLogGroupBD1F02DD" | ||
}, | ||
"awslogs-stream-prefix": "L3", | ||
"awslogs-region": { | ||
"Ref": "AWS::Region" | ||
} | ||
} | ||
}, | ||
"MountPoints": [], | ||
"Name": "web", | ||
"PortMappings": [ | ||
{ | ||
"ContainerPort": 80, | ||
"Protocol": "tcp" | ||
} | ||
], | ||
"Ulimits": [], | ||
"VolumesFrom": [] | ||
} | ||
], | ||
"Cpu": "512", | ||
"ExecutionRoleArn": { | ||
"Fn::GetAtt": [ | ||
"ExecutionRole605A040B", | ||
"Arn" | ||
] | ||
}, | ||
"Family": "awsecsintegL3TaskDefAA25240E", | ||
"Memory": "1GB", | ||
"NetworkMode": "awsvpc", | ||
"RequiresCompatibilities": [ | ||
"FARGATE" | ||
], | ||
"TaskRoleArn": { | ||
"Fn::GetAtt": [ | ||
"L3TaskDefTaskRole21C75D10", | ||
"Arn" | ||
] | ||
}, | ||
"Volumes": [] | ||
} | ||
}, | ||
"L3LoggingLogGroupBD1F02DD": { | ||
"Type": "AWS::Logs::LogGroup", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"L3Service616D5A93": { | ||
"Type": "AWS::ECS::Service", | ||
"Properties": { | ||
"TaskDefinition": { | ||
"Ref": "L3TaskDef48D8ACB8" | ||
}, | ||
"Cluster": { | ||
"Ref": "FargateCluster7CCD5F93" | ||
}, | ||
"DeploymentConfiguration": { | ||
"MaximumPercent": 200, | ||
"MinimumHealthyPercent": 50 | ||
}, | ||
"DesiredCount": 1, | ||
"LaunchType": "FARGATE", | ||
"LoadBalancers": [ | ||
{ | ||
"ContainerName": "web", | ||
"ContainerPort": 80, | ||
"TargetGroupArn": { | ||
"Ref": "L3LBPublicListenerECSGroup648EEA11" | ||
} | ||
} | ||
], | ||
"NetworkConfiguration": { | ||
"AwsvpcConfiguration": { | ||
"AssignPublicIp": "DISABLED", | ||
"SecurityGroups": [ | ||
{ | ||
"Fn::GetAtt": [ | ||
"L3ServiceSecurityGroup677B0897", | ||
"GroupId" | ||
] | ||
} | ||
], | ||
"Subnets": [ | ||
{ | ||
"Ref": "VpcPrivateSubnet1Subnet536B997A" | ||
}, | ||
{ | ||
"Ref": "VpcPrivateSubnet2Subnet3788AAA1" | ||
} | ||
] | ||
} | ||
}, | ||
"ServiceRegistries": [] | ||
}, | ||
"DependsOn": [ | ||
"L3LBPublicListenerECSGroup648EEA11", | ||
"L3LBPublicListener156FFC0F" | ||
] | ||
}, | ||
"L3ServiceSecurityGroup677B0897": { | ||
"Type": "AWS::EC2::SecurityGroup", | ||
"Properties": { | ||
"GroupDescription": "aws-ecs-integ/L3/Service/SecurityGroup", | ||
"SecurityGroupEgress": [ | ||
{ | ||
"CidrIp": "0.0.0.0/0", | ||
"Description": "Allow all outbound traffic by default", | ||
"IpProtocol": "-1" | ||
} | ||
], | ||
"SecurityGroupIngress": [], | ||
"VpcId": { | ||
"Ref": "Vpc8378EB38" | ||
} | ||
} | ||
}, | ||
"L3ServiceSecurityGroupfromawsecsintegL3LBSecurityGroupA70DA46C80DBDFBCD6": { | ||
"Type": "AWS::EC2::SecurityGroupIngress", | ||
"Properties": { | ||
"IpProtocol": "tcp", | ||
"Description": "Load balancer to target", | ||
"FromPort": 80, | ||
"GroupId": { | ||
"Fn::GetAtt": [ | ||
"L3ServiceSecurityGroup677B0897", | ||
"GroupId" | ||
] | ||
}, | ||
"SourceSecurityGroupId": { | ||
"Fn::GetAtt": [ | ||
"L3LBSecurityGroupEDE61198", | ||
"GroupId" | ||
] | ||
}, | ||
"ToPort": 80 | ||
} | ||
} | ||
}, | ||
"Outputs": { | ||
"L3LoadBalancerDNSC6CB4A70": { | ||
"Value": { | ||
"Fn::GetAtt": [ | ||
"L3LB212FC0E0", | ||
"DNSName" | ||
] | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.executionrole.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import ec2 = require('@aws-cdk/aws-ec2'); | ||
import ecs = require('@aws-cdk/aws-ecs'); | ||
import iam = require('@aws-cdk/aws-iam'); | ||
import cdk = require('@aws-cdk/cdk'); | ||
import ecsPatterns = require('../../lib'); | ||
|
||
const app = new cdk.App(); | ||
const stack = new cdk.Stack(app, 'aws-ecs-integ'); | ||
|
||
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 2 }); | ||
|
||
const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc }); | ||
|
||
new ecsPatterns.LoadBalancedFargateService(stack, 'L3', { | ||
cluster, | ||
memoryMiB: '1GB', | ||
cpu: '512', | ||
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"), | ||
executionRole: new iam.Role(stack, 'ExecutionRole', { | ||
assumedBy: new iam.CompositePrincipal( | ||
new iam.ServicePrincipal("ecs.amazonaws.com"), | ||
new iam.ServicePrincipal("ecs-tasks.amazonaws.com") | ||
) | ||
}) | ||
}); | ||
|
||
app.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters