question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(ec2): support throughput option in EBS volume

See original GitHub issue

For EBS volumes with volume type GP3, the throughput in MiB/s can be configured. This is currently not supported in CDK.

Workaround: use escape hatches

Use Case

Set custom value for throughput, impacts performance and pricing.

Proposed Solution

The property is available in ebs volume and launchtemplate blockdevicemaping. It should be supported in both constructs.

Check if the property can be added to EbsDeviceOptionsBase or only to one of its subclasses (EbsDeviceOptions and EbsDeviceSnapshotOptions). Nothing specific is mentioned in the documentation.

Display a warning if throughput is defined for a volume type that does not support specifying a throughput. Display an error if a throughput value is specified that is not supported.

Other

Originally mentioned as comment in issue #12020.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
csumptercommented, Nov 4, 2022

Hey, i just stumbled upon this issue while looking for a way of defining the throughput of GP3 volumes. I understand from this PR that it’s not currently supported via the aws_ec2.BlockDeviceVolume.ebs function.

Until this feature is merged, is there any workaround for defining it?

You can do something like:

    interface ExtendedEbsDeviceOptions extends autoscaling.EbsDeviceOptions {
      throughput: number;
    }

    const asg = new autoscaling.AutoScalingGroup(this, "example", {
      blockDevices: [{
        deviceName: "/dev/sda1",
        volume: autoscaling.BlockDeviceVolume.ebs(1, {
         ...
          volumeType: autoscaling.EbsDeviceVolumeType.GP3,
          throughput: 125,
        } as ExtendedEbsDeviceOptions),
      }],
      ...
    })

This extends the type to include throughput where it will becomes rendered as Throughput by the cdk as it transforms that property.

There are other ways to get the throughput property rendered out with the resource but this is probably the easiest.

If you need to do get the compatibility for an ec2 volume you would do something like:

    interface Ec2VolumeExtended extends ec2.VolumeProps {
      throughput: number;
    }
    const volume = new ec2.Volume(this, "volume", {
      volumeType: ec2.EbsDeviceVolumeType.GP3,
      throughput: 125,
      ...
    } as Ec2VolumeExtended)
0reactions
tmokmsscommented, Dec 21, 2022

I also stumbled on this today for launch templates. Here’s the workaround:

const launchTemplate = new ec2.LaunchTemplate(this, 'LaunchTemplate', {
  // omitting other required properties
  blockDevices: [
    {
      deviceName: '/dev/xvda',
      volume: ec2.BlockDeviceVolume.ebs(100, {
        volumeType: ec2.EbsDeviceVolumeType.GP3,
      }),
    },
  ],
});
(launchTemplate.node.defaultChild as CfnResource).addPropertyOverride("LaunchTemplateData.BlockDeviceMappings.0.Ebs.Throughput", 200)

I’m not sure why LaunchTemplate ebs supports throughput (doc), whereas instance ebs not (doc).

edit) I found the corresponding issue on CFn repo: https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/824

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon EBS–optimized instances
Instance size Maximum bandwidth (Mbps) Maximum throughput (MB/s, 128 KiB I/O) Maxim... a1.medium * 3,500 437.5 20,000 a1.large * 3,500 437.5 20,000 a1.xlarge * 3,500 437.5...
Read more >
AWS EBS Performance - Jayendra's Cloud Certification Blog
The EC2 Instance is EBS-Optimized and supports 500 Mbps throughput between EC2 and EBS. The two EBS volumes are configured as a single...
Read more >
Amazon EBS Features - Amazon Web Services
EBS-optimized instances deliver dedicated throughput between Amazon EC2 and Amazon EBS, with options between 500 and 19,000 Megabits per second (Mbps) depending ...
Read more >
EBS Volume Performance - Crishantha Nanayakkara - Medium
When you create AWS EC2 instances, you can attach two types of volumes to them. ... Out of these two volume options, EBS...
Read more >
Amazon EBS: How to Get More from Your Elastic Block Store
EBS Optimization provides dedicated bandwidth between your EC2 instances and EBS volumes. It is designed to improve I/O and throughput ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found