aws / aws/aws-cdk

(ec2): Cannot attach Volume to Instance

Open
#16,001 6 comments 5 reactions 0 assignees View on GitHub
@aws-cdk/aws-ec2 effort/small feature-request mixins p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

ec2.Instance only currently supports attaching volumes with type BlockDeviceVolume.
See
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Instance.html#blockdevices
and
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.BlockDevice.html

### Use Case

CloudFormation supports attaching Volumes created separately from the Instance. It would be nice to have the same support for the L2 CDK classes.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html#cfn-ec2-instance-volumes

### Proposed Solution
I believe this would involve adding a new property, `volumes` to [Instance](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Instance.html#blockdevices) of a type that maps a device name to [Volume](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-ec2.Volume.html).
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-mount-point.html

### Other

* [ ] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change

---

This is a :rocket: Feature Request

Contributor guide

Open the contributing guide

Research direction

Start with the EC2 Instance, BlockDeviceVolume, and Volume APIs, then compare them with CloudFormation's volumes and mount-point properties. Done means Instance supports attaching separately created Volumes by device name, matching the requested L2 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.