Skip to content

migrating api/auth/aws from aws-sdk-go to aws-sdk-go-v2#71

Merged
rahulkaukuntla merged 3 commits into
DataDog:masterfrom
rahulkaukuntla:rahul/use-v2-sdk-with-api-auth-aws
Jul 16, 2025
Merged

migrating api/auth/aws from aws-sdk-go to aws-sdk-go-v2#71
rahulkaukuntla merged 3 commits into
DataDog:masterfrom
rahulkaukuntla:rahul/use-v2-sdk-with-api-auth-aws

Conversation

@rahulkaukuntla
Copy link
Copy Markdown

Description

What does this PR do?

aws-sdk-go is being deprecated by July 31, 2025, and any usages of this dependency need to be migrated to aws-sdk-go-v2. It seems that api/auth/aws depends on this old dependency, which means that importing it, along with the vault repo in general, causes both versions of the sdk to be imported, blowing up the size of any binary that depends on api/auth/aws. To remediate this issue, I have:

  1. Replaced deprecated AWS SDK v1-style imports (session, ec2metadata, etc.) with modern AWS SDK v2 modules like config and imds.
  2. Removed the go-secure-stdlib/awsutil dependency (which itself depends on the v1 SDK) in favor of using standard AWS SDK v2 interfaces (aws.CredentialsProvider).
  3. Updated the EC2 metadata handling to use imds.GetDynamicData(ctx, &Input) and properly read from io.ReadCloser responses.
  4. Switched IAM auth logic to retrieve credentials from cfg.Credentials via Retrieve(ctx) and manually build the loginData map.

I have verified that this fix works by locally importing this updated library into a local instance of the datadog-secret-backend executable, and using that, I was successfully able to pull secrets from my AWS-enabled Hashicorp Vault. The generated datadog-secret-backend executable decreased in size from ~16 MiB to ~11 MiB, since we don't have to ship aws-sdk-go anymore, showing just how important this change is to us.

If this PR is approved, I can officially bump the version in the datadog-secret-backend repository.

TODO only if you're a HashiCorp employee

  • Backport Labels: If this fix needs to be backported, use the appropriate backport/ label that matches the desired release branch. Note that in the CE repo, the latest release branch will look like backport/x.x.x, but older release branches will be backport/ent/x.x.x+ent.
    • LTS: If this fixes a critical security vulnerability or severity 1 bug, it will also need to be backported to the current LTS versions of Vault. To ensure this, use all available enterprise labels.
  • ENT Breakage: If this PR either 1) removes a public function OR 2) changes the signature
    of a public function, even if that change is in a CE file, double check that
    applying the patch for this PR to the ENT repo and running tests doesn't
    break any tests. Sometimes ENT only tests rely on public functions in CE
    files.
  • Jira: If this change has an associated Jira, it's referenced either
    in the PR description, commit message, or branch name.
  • RFC: If this change has an associated RFC, please link it in the description.
  • ENT PR: If this change has an associated ENT PR, please link it in the
    description. Also, make sure the changelog is in this PR, not in your ENT PR.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.
  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
  • If applicable, I've documented the impact of any changes to security controls.

Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@rahulkaukuntla rahulkaukuntla marked this pull request as ready for review July 16, 2025 19:27
@rahulkaukuntla rahulkaukuntla requested a review from dustmop July 16, 2025 19:28
@rahulkaukuntla rahulkaukuntla merged commit 44fb304 into DataDog:master Jul 16, 2025
14 of 16 checks passed
rahulkaukuntla added a commit that referenced this pull request Sep 12, 2025
…auth-aws

migrating `api/auth/aws` from `aws-sdk-go` to `aws-sdk-go-v2`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants