Полный список пространств имен и параметров:
Это просто в качестве примера.
import cdk = require('@aws-cdk/core');
import {IVpc, Peer, Port, SecurityGroup,} from "@aws-cdk/aws-ec2";
import {CfnApplication, CfnEnvironment} from '@aws-cdk/aws-elasticbeanstalk';
interface ApplicationStackProps extends cdk.StackProps {
vpc: IVpc;
}
export class ApplicationStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props: ApplicationStackProps) {
super(scope, id, props);
const prj: string = this.node.tryGetContext("prj");
const stage: string = this.node.tryGetContext("stage");
const platform: string = this.node.tryGetContext("platform");
const albSecurityGroup = new SecurityGroup(this, 'albSecurityGroup', {
allowAllOutbound: true,
securityGroupName: 'alb-sg',
vpc: props.vpc,
});
albSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.tcp(80));
albSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.tcp(443));
const app = new CfnApplication(this, 'Application', {
applicationName: `${prj}-${stage}-application`
});
const optionSettings: CfnEnvironment.OptionSettingProperty[] = [
{
namespace: 'aws:ec2:vpc',
optionName: 'VPCId',
value: props.vpc.vpcId,
},
{
namespace: 'aws:ec2:vpc',
optionName: 'ELBSubnets',
value: props.vpc.publicSubnets.map(value => value.subnetId).join(','),
}
,
{
namespace: 'aws:ec2:vpc',
optionName: 'Subnets',
value: props.vpc.privateSubnets.map(value => value.subnetId).join(','),
}
];
const env = new CfnEnvironment(this, 'Environment', {
environmentName: 'Environment',
applicationName: app.applicationName || `${prj}-${stage}-application`,
platformArn: platform,
optionSettings: optionSettings,
});
}
}