constructor()

in cdk-stacks/lib/cdk-frontend-stack.ts [17:57]


    constructor(scope: cdk.Construct, id: string, props: CdkFrontendStackProps) {
        super(scope, id, props);

        //store physical stack name to SSM
        const outputHierarchy = `${configParams.hierarchy}outputParameters`;
        const cdkFrontendStackName = new ssm.StringParameter(this, 'CdkFrontendStackName', {
            parameterName: `${outputHierarchy}/CdkFrontendStackName`,
            stringValue: this.stackName
        });

        const frontendS3DeploymentStack = new FrontendS3DeploymentStack(this, 'FrontendS3DeploymentStack', {
            cdkAppName: configParams['CdkAppName'],
            webAppBucket: props.webAppBucket
        });



        const webAppCloudFrontDistribution = new cloudfront.CloudFrontWebDistribution(this, `${configParams['CdkAppName']}-WebAppDistribution`, {
            comment: `CloudFront for ${configParams['CdkAppName']}`,
            originConfigs: [
                {
                    s3OriginSource: {
                        s3BucketSource: props.webAppBucket,
                        originPath: `/${configParams['WebAppRootPrefix'].replace(/\/$/, "")}`,
                        originAccessIdentity: props.webAppCloudFrontOAI,
                    },
                    behaviors: [
                        {
                            defaultTtl: cdk.Duration.minutes(1),
                            isDefaultBehavior: true,
                        },
                    ]
                }
            ],
            errorConfigurations: [{
                errorCode: 403,
                errorCachingMinTtl: 60,
                responsePagePath: '/index.html',
                responseCode: 200
            }]
        });