feat(runners): add volume_initialization_rate to block_device_mappings#5165
feat(runners): add volume_initialization_rate to block_device_mappings#5165slavab89 wants to merge 1 commit into
Conversation
|
Hey @slavab89, This sounds like a great addition! If I understand it correctly this will speed up the initial boot of a fresh runner right? Nice work on the PR! Thank you 👍🏼 |
There was a problem hiding this comment.
Pull request overview
Adds support for the AWS Launch Template EBS volume_initialization_rate attribute by threading a new optional field through the block_device_mappings variable schema into the aws_launch_template ebs {} block, enabling faster snapshot-backed volume initialization for runner instances.
Changes:
- Extend
block_device_mappingsobject types to includevolume_initialization_rate(optional number) at root, runners module, and multi-runner module. - Pass
volume_initialization_ratethrough to theaws_launch_template.runnerblock_device_mappings.ebsconfiguration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| variables.tf | Adds volume_initialization_rate to the root block_device_mappings input schema/description. |
| modules/runners/variables.tf | Mirrors the schema/description change for the runners module input. |
| modules/runners/main.tf | Wires volume_initialization_rate into the launch template EBS block device mapping. |
| modules/multi-runner/variables.tf | Mirrors the schema change inside multi_runner_config.runner_config.block_device_mappings and updates its inline docs string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add support for the volume_initialization_rate EBS parameter in launch templates. This allows configuring provisioned rate for volume initialization (MiB/s) to accelerate EBS snapshot hydration on new instances, instead of relying on the default lazy initialization. See https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html
3e18bbc to
8626fdd
Compare
|
Hey @Brend-Smits That's correct, it can speed up initial boot time but also improve speeds of any scripts or workloads that you may have that interact with the EBS for the first time (i.e we've created an AMI with a lot of files that we need to read during PRs, this definitely speeds up the CI for us) |
No worries! I will try to get this PR reviewed soon. |
|
Definitely, I've put them in the Issue #5165 assuming people will get there first. Broadly, the regular rate your get in AWS is ~5MiB/s for initial reads, so for 1 GiB, its going to take ~3 mins to read (serially) but with the 200 MiB/s, its going to be 5 seconds and cost you ~$0.002. |
|
@slavab89 Can you also add support in the dynamic labels? |
|
Unfortunatelly, this does not seem to be supported as part of FleetEbsBlockDeviceRequest Its only available through the Launch Template or RunInstances EbsBlockDevice |
Description
Add support for the
volume_initialization_rateEBS parameter in launch templates. This allows configuring the provisioned rate (MiB/s) for volume initialization from snapshots, replacing the default lazy initialization (~5 MiB/s on first touch).Changes:
modules/runners/variables.tf— addvolume_initialization_rate = optional(number)toblock_device_mappingsobject typemodules/runners/main.tf— pass through toebs {}block inaws_launch_templatemodules/multi-runner/variables.tf— mirror the type additionvariables.tf(root) — mirror the type additionWhen unset (
null), the attribute is omitted and AWS uses default behavior. No breaking changes.Cost Implications
Provisioned Rate for Volume Initialization is a one-time charge per volume creation, billed as:
In us-east-1 at 300 MiB/s: ~$0.0036 per GiB of snapshot data per volume.
Example: a 500 GiB volume from a snapshot with 250 GiB of data at 200 MiB/s ≈ $0.60 per volume creation. This is an opt-in parameter (
optional(number), defaultnull) — users who don't set it pay nothing extra.See EBS Pricing — Example 12.
Test Plan
terraform fmt -checkpasses on all modified filesterraform validatepassesvolume_initialization_rate = 200on a gp3 volume created from a 568 GB snapshot; confirmed viaaws ec2 describe-launch-template-versionsthatVolumeInitializationRate: 200is present on the default versionFixes #5163