I am getting error while adding 2 block device mappings for ebs volumes. I am using aws-cdk, python.
Here is the code
from aws_cdk import core
from aws_cdk import aws_ec2 as _ec2
#Webserver 01
webserver = _ec2.Instance(
self,
"webserver01Id",
instance_type = _ec2.InstanceType(instance_type_identifier="t2.micro"),
instance_name = "webserver001",
machine_image = _amzn_linux_ami,
vpc=vpc,
vpc_subnets = _ec2.SubnetSelection(subnet_type=_ec2.SubnetType.PUBLIC),
user_data = _ec2.UserData.custom(_user_data),
block_devices= {"block_device_mappings": [
{"device_name ": '/dev/sda1', "volume": _ec2.BlockDeviceVolume.ebs(50)},
{"device_name": '/dev/sdm', "volume": _ec2.BlockDeviceVolume.ebs(100)}
]
}
)
Here is the error I am getting.
jsii.errors.JSIIError: Expected array type, got {"$jsii.map":{"block_device_mappings":[{"$jsii.map":{"device_name ":"/dev/sda1","volume":{"$jsii.byref":"@aws-cdk/aws-ec2.BlockDeviceVolume@10012"}}},{"$jsii.map":{"device_name":"/dev/sdm","volume":{"$jsii.byref":"@aws-cdk/aws-ec2.BlockDeviceVolume@10013"}}}]}} Subprocess exited with error 1