Slide 10
Slide 10 text
import { HopTabiWafStack } from '../lib/waf-stack' ;
const regionalWafStack = new HopTabiWafStack (
app,
'HopCommonRegionalWafStack' ,
appContext ,
'REGIONAL' ,
wafParameterNames .regionalAclArn ,
stackProps
);
const globalWafStack = new HopTabiWafStack (
app,
'HopCommonGlobalWafStack' ,
appContext ,
'CLOUDFRONT' ,
undefined ,
globalRegionStackProps
);
複数アプリのインフラ構成をCDK管理する
コード例:AWS WAFをクロスリージョンで構築してスタック間参照させる
const wafSsmStack = new cdk.Stack(app, 'HopCommonWafSsmStack'
, {
...stackProps,
crossRegionReferences: true,
});
new ssm.StringParameter
(wafSsmStack, 'GlobalAclArn'
, {
parameterName: wafParameterNames
.globalAclArn,
stringValue: globalWafStack
.webAcl.attrArn,
});
new ssm.StringParameter
(wafSsmStack, 'HopGlobalCustomerAclArn'
, {
parameterName: wafParameterNames
.globalCustomerAclArn
,
stringValue: globalWafStack
.hopCustomerWebAcl
.attrArn,
});
wafSsmStack.addDependency(globalWafStack
);