sparse-intern-71089
09/18/2020, 5:48 AMmillions-furniture-75402
09/18/2020, 1:10 PMmillions-furniture-75402
09/18/2020, 1:12 PMconst appSecurityGroup = new awsx.ec2.SecurityGroup(`${appName}-sg`, {
ingress: [{ fromPort: 3000, toPort: 3000, protocol: "tcp", cidrBlocks: ["0.0.0.0/0"] }],
egress: [{ fromPort: 0, toPort: 0, protocol: "-1", cidrBlocks: ["0.0.0.0/0"] }],
vpc,
});
const lbSecurityGroup = new awsx.ec2.SecurityGroup(`${appName}-default-http-and-https`, {
egress: [{ fromPort: 3000, toPort: 3000, protocol: "tcp", sourceSecurityGroupId: appSecurityGroup.id }],
vpc,
});
const alb = new awsx.lb.ApplicationLoadBalancer(`${appName}-lb`, {
external: true,
securityGroups: [lbSecurityGroup],
subnets: vpc.publicSubnetIds,
vpc,
});
millions-furniture-75402
09/18/2020, 1:12 PMgentle-diamond-70147
09/18/2020, 3:01 PMtoPort: 65534
) before deleting the old rule and the port ranges overlap - 0-65535
is inclusive of 0-65534
. So they are effectively duplicate.gentle-diamond-70147
09/18/2020, 3:02 PMdeleteBeforeReplace
.
e.g.
new aws.ec2.SecurityGroupRule(`sg-ingress-alb-to-containers`, {
type: 'ingress',
description: 'Allow all traffics from ALB to ECS containers',
protocol: 'all',
fromPort: 0,
toPort: 65534,
cidrBlocks: ["0.0.0.0/0"],
securityGroupId: albSg.id,
}, {
deleteBeforeReplace: true
});