constructor()

in source/backend/lib/cdk-photosearch-stack.ts [19:60]


  constructor(scope: cdk.Construct, id: string) {
    const props = {
      description: 'SO0173 Ver 1.0.0',
    };
    super(scope, id, props);

    const apiGatewayAllowOrigin = new cdk.CfnParameter(this, 'ApiGatewayAllowOrigin', {
      type: 'String',
      description: 'Enter allowed origin for the api gateway',
      default: '*',
    });
    const bucketAllowOrigin = new cdk.CfnParameter(this, 'S3BucketAllowOrigin', {
      type: 'String',
      description: 'Enter allowed origin for the s3 bucket to upload images',
      default: '*',
    });
    const webConsoleAllowedIpAddressCidr = new cdk.CfnParameter(this, 'WebConsoleAllowedIpAddressCidr', {
      description: 'Enter IP address range allowed to access the web console. The format is like; x.x.x.x/y',
      type: 'String',
    });
    const aesInstanceType = new cdk.CfnParameter(this, 'AESInstanceType', {
      description: 'Enter Amazon Elasticsearch Service InstanceType',
      type: 'String',
      default: 't3.small.elasticsearch',
    });
    const backendStack = new PhotoSearchBackendStack(this, 'Backend', {
      bucketAllowOrigin: bucketAllowOrigin.valueAsString,
      apiGatewayAllowOrigin: apiGatewayAllowOrigin.valueAsString,
      aesInstanceType: aesInstanceType.valueAsString,
    });

    const frontendStack = new PhotoSearchFrontendStack(this, 'Frontend', {
      apiId: backendStack.apiId,
      identityPoolId: backendStack.identityPoolId,
      webConsoleAllowedIpAddressCidr: webConsoleAllowedIpAddressCidr.valueAsString,
    });

    new cdk.CfnOutput(this, 'WebConsoleURL', {
      description: 'URL to the web console',
      value: frontendStack.distributionDomainName,
    });
  }