I am new to AWS CDK.
I have created aws code pipeline using aws cdk (Typescript) and it creates whole pipeline and deploy my application to Elastic beanstalk but the problem is it does not assign any VPC or security group to it and hence makes my application public by default.
I want my application to be accessible only through my company network using VPC that is already available in our aws account (say name of VPC is "InternalPrivateVPC") not publicly.
So I am trying to find out a way to assign already available VPC and SG to my application using aws cdk code but could not find any property or class related to Elastic beanstalk class which will allow me to assign VPC and SG to application in code.
const appName = "SampleDotNetMVCWebApp";
const app = new elasticbeanstalk.CfnApplication(this, "EBApplication", {
applicationName: appName
});
const elbEnv = new elasticbeanstalk.CfnEnvironment(this, "Environment", {
environmentName: "SampleMVCEBEnvironment",
applicationName: appName,
solutionStackName: "64bit Windows Server 2012 R2 v2.5.0 running IIS 8.5"
});
Here is the whole code repo - https://github.com/dhirajkhodade/CDKDotNetWebAppEbPipeline and here is specific file which creates Elastic beanstalk app and environment - https://github.com/dhirajkhodade/CDKDotNetWebAppEbPipeline/blob/master/lib/cdk_dot_net_web_app_eb_pipeline-stack.ts
optionSettings
to provide VPC and Subnet Ids when creatingCfnEnvironment
. Also refer this page as to howoption_settings
can be provided. CDK defers to CFN attributes whenever necessary. – dmahapatroec2vpc
general option setting – dmahapatro