Skip to content

enhancement(aws_ec2_metadata transform): support additional IMDS categories#25533

Open
xfocus3 wants to merge 1 commit into
vectordotdev:masterfrom
xfocus3:feat/ec2-metadata-additional-imds-categories
Open

enhancement(aws_ec2_metadata transform): support additional IMDS categories#25533
xfocus3 wants to merge 1 commit into
vectordotdev:masterfrom
xfocus3:feat/ec2-metadata-additional-imds-categories

Conversation

@xfocus3
Copy link
Copy Markdown

@xfocus3 xfocus3 commented May 30, 2026

Summary

This PR extends the aws_ec2_metadata transform to support additional IMDS instance metadata categories, as requested in #22069. The following fields can now be requested via the fields option:

  • availability-zone-id (placement/availability-zone-id) — unlike the availability zone name, the AZ ID is consistent across AWS accounts, which is useful for correlating zonal impact in multi-account deployments.
  • partition (services/partition)
  • domain (services/domain)
  • placement-group-name (placement/group-name)
  • placement-partition-number (placement/partition-number)
  • host-id (placement/host-id) — useful for identifying bad Dedicated Hosts (e.g. EC2 Mac instances).
  • autoscaling-target-lifecycle-state (autoscaling/target-lifecycle-state) — useful for correlating EC2 Auto Scaling lifecycle hook events with on-instance events.

Each new field follows the existing pattern for optional categories (such as account-id and tags): it is opt-in and only fetched when explicitly listed in fields. The default field allowlist is unchanged, so there is no change in behavior or additional IMDS requests for existing configurations.

Vector configuration

transforms:
  ec2_meta:
    type: aws_ec2_metadata
    inputs: ["in"]
    fields:
      - "instance-id"
      - "availability-zone-id"
      - "partition"
      - "domain"
      - "placement-group-name"
      - "placement-partition-number"
      - "host-id"
      - "autoscaling-target-lifecycle-state"

How did you test this PR?

  • cargo check --lib --no-default-features --features transforms-aws_ec2_metadata — passes
  • cargo test --lib --no-default-features --features transforms-aws_ec2_metadata aws_ec2_metadata — passes
  • cargo fmt --check — passes
  • cargo clippy --lib --no-default-features --features transforms-aws_ec2_metadata -- -D warnings — passes

The new categories are all simple flat IMDS GET endpoints fetched through the existing get_metadata helper (which already handles IMDSv2 tokens and 404 responses by skipping the field), so they reuse the transform's existing token/refresh/error-handling logic. IMDS paths were verified against the AWS EC2 instance metadata categories documentation.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

…gories

Add support for the following IMDS instance metadata categories to the
aws_ec2_metadata transform, requestable via the `fields` option:

- availability-zone-id (placement/availability-zone-id)
- partition (services/partition)
- domain (services/domain)
- placement-group-name (placement/group-name)
- placement-partition-number (placement/partition-number)
- host-id (placement/host-id)
- autoscaling-target-lifecycle-state (autoscaling/target-lifecycle-state)

These help locate impacted instances (e.g. by availability zone ID, which
is consistent across accounts, or by Dedicated Host ID) and correlate EC2
Auto Scaling lifecycle events with on-instance events. Each new field is
opt-in and only fetched when explicitly listed in `fields`, so there is no
change in behavior for existing configurations.

Closes vectordotdev#22069
@xfocus3 xfocus3 requested review from a team as code owners May 30, 2026 09:46
@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: transforms Anything related to Vector's transform components domain: external docs Anything related to Vector's external, public documentation labels May 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 30, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@xfocus3
Copy link
Copy Markdown
Author

xfocus3 commented May 30, 2026

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation domain: transforms Anything related to Vector's transform components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transforms – AWS EC2 Metadata – Support Additional IMDS Instance Metadata Categories

1 participant