Search code examples
amazon-web-servicesamazon-elastic-beanstalkaws-cdk

Set beanstalk subdomain in CDK


In web console I can choose any subdomain I like for my beanstalk environment enter image description here

How can I achieve this in CDK (typescript)?


Solution

  • This can be set in cnamePrefix

    const website_env = new aws_elasticbeanstalk.CfnEnvironment(this, 'Environment', {
        cnamePrefix: 'some-sub-domain', 
        ...
    }
    

    The complete domain then becomes some-sub-domain.${this.region}.elasticbeanstalk.com