How can I create ec2 node with defined storage size from CDK
This is my construct
const instance = new Instance(this, 'SolrInstance', {
vpc: vpc,
instanceName: 'SolrInstance',
instanceType: InstanceType.of(InstanceClass.BURSTABLE3, InstanceSize.NANO),
machineImage: ubuntuImage,
allowAllOutbound: true,
keyName: 'solr-key',
vpcSubnets: { subnetType: SubnetType.PRIVATE },
securityGroup: SolrSecurityGroup,
});
How do i specify the ebs volume of this instance?
Hey @icecold21,
It looks like the BlockDeviceMappings property is missing from the L2 Instance construct.
Until they're added, you'll need to modifiy the CloudFormation properties directly, something like:
const cfnInstance = instance.node.defaultChild as CfnInstance;
// @ts-ignore - readonly
cfnInstance.blockDeviceMappings = [{
deviceName: '/dev/sda',
ebs: {volumeSize: 20},
}];
I'll look into making a PR to ease that process
EDIT: I actually already did most of the work for aws-autoscaling with #3622, this should be fairly easy to port to aws-ec2
Most helpful comment
Hey @icecold21,
It looks like the
BlockDeviceMappingsproperty is missing from the L2Instanceconstruct.Until they're added, you'll need to modifiy the CloudFormation properties directly, something like:
I'll look into making a PR to ease that process
EDIT: I actually already did most of the work for
aws-autoscalingwith #3622, this should be fairly easy to port toaws-ec2