bumpy-restaurant-1466
12/26/2019, 1:40 AMawsx.ec2.Vpc
with 4 different subnet groups (private, public, db, redis). In order for them to show in the console as sensible name you can include tags: { Name: "db" }
for each subnet, however unfortunately that results in a subnet group’s subnets having the same name regardless of what az they are in. Instead I’d like to have their names follow the format example-name-az
or example-name-number
, eg example-db-us-west-2
or example-db-2
. How can I achieve this without needing to specify each az subnet one at a time?flat-insurance-25294
12/26/2019, 3:27 PMgentle-diamond-70147
12/26/2019, 4:57 PMconst zones = aws.getAvailabilityZones().zoneIds;
const subnets = zones.map((zoneId, i) => {
return new aws.ec2.Subnet(`demo-${i}`, {
vpcId: vpc.id,
availabilityZoneId: zoneId,
cidrBlock: `10.0.${i}.0/22`,
tags: {
Name: `demo-${i}`,
},
}, { parent: vpc, })
});