@@ -3,7 +3,7 @@ import * as path from 'path';
33import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2' ;
44import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets' ;
55import { type Construct } from 'constructs' ;
6- import { Stack , type StackProps , type Environment , Tags , CfnOutput } from 'aws-cdk-lib' ;
6+ import { Stack , type StackProps , type Environment , Tags , Fn , CfnOutput } from 'aws-cdk-lib' ;
77import { StringParameter } from 'aws-cdk-lib/aws-ssm' ;
88import { ApiGateway } from './api-gateway' ;
99import { type ApiKeySSMParameterNames } from '../interfaces/api-key-ssm-parameter-names' ;
@@ -34,10 +34,15 @@ export class SharedInfraStack extends Stack {
3434 constructor ( scope : Construct , id : string , props : SharedInfraProps ) {
3535 super ( scope , id ) ;
3636
37+ const azs = Fn . getAzs ( this . region ) ;
3738 this . vpc = new ec2 . Vpc ( this , 'sbt-ecs-vpc' , {
3839 // maxAzs: 3,
3940 ipAddresses : ec2 . IpAddresses . cidr ( '10.0.0.0/16' ) ,
40- availabilityZones : [ `${ props . env . region } a` , `${ props . env . region } b` , `${ props . env . region } c` ] ,
41+ availabilityZones : [
42+ Fn . select ( 0 , azs ) ,
43+ Fn . select ( 1 , azs ) ,
44+ Fn . select ( 2 , azs ) ,
45+ ] ,
4146 flowLogs : {
4247 'sbt-ecs-vpcFlowLog' : {
4348 destination : ec2 . FlowLogDestination . toCloudWatchLogs ( ) ,
@@ -168,6 +173,20 @@ export class SharedInfraStack extends Stack {
168173 exportName : 'EcsVpcId'
169174 } ) ;
170175
176+
177+ new CfnOutput ( this , 'az1' , {
178+ value : this . vpc . availabilityZones [ 0 ] ,
179+ exportName : 'az1'
180+ } ) ;
181+ new CfnOutput ( this , 'az2' , {
182+ value : this . vpc . availabilityZones [ 1 ] ,
183+ exportName : 'az2'
184+ } ) ;
185+ new CfnOutput ( this , 'az3' , {
186+ value : this . vpc . availabilityZones [ 2 ] ,
187+ exportName : 'az3'
188+ } ) ;
189+
171190 new CfnOutput ( this , 'PrivSubId1EcsSbt' , {
172191 value : this . vpc . privateSubnets [ 0 ] . subnetId ,
173192 exportName : 'PrivSubId1EcsSbt'
0 commit comments