Skip to content

[VAULT-22277] AWS SDK Migration to Version 2#191

Open
bcsamrudh wants to merge 25 commits into
mainfrom
VAULT-22277/aws-sdk-migration
Open

[VAULT-22277] AWS SDK Migration to Version 2#191
bcsamrudh wants to merge 25 commits into
mainfrom
VAULT-22277/aws-sdk-migration

Conversation

@bcsamrudh

@bcsamrudh bcsamrudh commented May 5, 2026

Copy link
Copy Markdown

Description
This pull request migrates the project from the legacy AWS SDK for Go (aws-sdk-go) to the modern AWS SDK for Go v2 (aws-sdk-go-v2). This update affects the main application code, tests, and dependencies, and brings the codebase up to date with current AWS SDK.

Key Changes:

  1. Replaced all usage of github.com/aws/aws-sdk-go with github.com/aws/aws-sdk-go-v2 and its submodules throughout the codebase, including main logic, tests, and supporting modules. Refactored how AWS sessions, credentials, and service clients are initialized and used.

  2. Vault AWS authentication flows were updated to use SDK v2 configuration and credential provider patterns, including STS client usage and request-signing behavior changes required by v2 APIs.

  3. Updated the Dockerfile to use the latest available base image and dependencies to ensure compatibility with the AWS SDK v2 migration.Additionally, this PR changes the default EC2 instance type in the quick-start Terraform configuration.

  4. Client now uses constructor-provided authConfig (c.authConfig) instead of Config from the environment (config.AuthConfigFromEnv())

  5. Previously, the configuration would always pick the latest Ubuntu AMI, including ARM-based variants. Since the instance type uses the x86_64 architecture, this could result in errors such as:
    " Error: creating EC2 Instance: InvalidParameterValue: The architecture 'x86_64' of the specified instance type does not match the architecture 'arm64' of the specified AMI. "
    This change ensures that only x86 Ubuntu AMIs are selected, keeping the AMI architecture aligned with the instance architecture.

  6. Testing: Verified stability through unit tests, build checks, and AWS acceptance tests for all updated functionality.

  7. Code Cleanup: Removed deprecated utilities and updated helper functions to use supported Go and AWS SDK v2 methods.

Ticket : VAULT-22277

Testing Evidence:

  1. End to End Testing
tempImageqxFswR
  1. Integration Tests
tempImagebvEoUT tempImageUS4JH2
  1. Unit Tests
tempImageammgsF

@bcsamrudh bcsamrudh marked this pull request as ready for review May 6, 2026 04:18
@bcsamrudh bcsamrudh requested review from a team as code owners May 6, 2026 04:18
@bcsamrudh bcsamrudh requested a review from Copilot May 6, 2026 05:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the vault-lambda-extension codebase from AWS SDK for Go v1 to AWS SDK for Go v2, updating runtime client initialization and the Vault AWS IAM login flow (STS request construction/signing), along with associated tests and dependency updates.

Changes:

  • Replace AWS SDK v1 session-based initialization with AWS SDK v2 config.LoadDefaultConfig and v2 STS clients.
  • Refactor Vault IAM login to manually construct and SigV4-sign an STS GetCallerIdentity request using AWS SDK v2 signing utilities.
  • Update test tooling and local test containers/configuration (Dockerfiles, compose, quick-start defaults) to match the new SDK/tooling direction.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
main.go Switches to AWS SDK v2 config loading and passes v2 aws.Config into the Vault client.
internal/vault/client.go Updates client to use v2 STS client; rewrites IAM login request signing and adds STS endpoint resolver helper.
internal/vault/client_test.go Updates unit tests to use v2 config + v2 STS client construction.
internal/ststest/sts.go Refactors FakeSTS helper to configure an aws.Config (v2) instead of a v1 session.
internal/proxy/proxy_test.go Updates proxy tests to use v2 AWS config and updated Vault client constructor signature.
go.mod / go.sum Replaces v1 AWS SDK dependency with AWS SDK v2 modules and updates indirect deps.
test/lambda/Dockerfile Updates Vault base image and Go builder image used for local/integration testing.
test/api/Dockerfile Updates Go builder image used for local API test container build.
test/docker-compose.yaml Updates Vault image version and adds IPC_LOCK capability for the Vault container.
quick-start/terraform/variables.tf Updates default EC2 instance type for the quick-start environment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/vault/client.go
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go
Comment thread internal/vault/client.go Outdated
Comment thread test/lambda/Dockerfile Outdated
Comment thread test/api/Dockerfile Outdated
bcsamrudh and others added 3 commits May 6, 2026 10:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Comment thread internal/proxy/proxy_test.go
Comment thread internal/proxy/proxy_test.go Outdated
Comment thread quick-start/terraform/variables.tf
Comment thread test/docker-compose.yaml
Comment thread test/lambda/Dockerfile
Comment thread test/api/Dockerfile
Comment thread internal/vault/client.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go Outdated
Comment thread internal/proxy/proxy_test.go Outdated
Comment thread internal/proxy/proxy_test.go

@arjunkshashicorp arjunkshashicorp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread internal/vault/client.go
Comment thread internal/vault/client.go
Comment thread internal/vault/client.go

@Balaji2198 Balaji2198 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Added few comments.
For manual testing, could you please use the Quickstart example in hashicorp/vault-lambda-extension to verify these changes if that hasn’t been done already?

Comment thread internal/proxy/proxy_test.go Outdated
Comment thread internal/ststest/sts.go
Comment thread internal/vault/client_test.go
….AssumedRoleArn (i.e roleToAssumeArn) are set
@bcsamrudh

Copy link
Copy Markdown
Author

For manual testing, could you please use the Quickstart example in hashicorp/vault-lambda-extension to verify these changes if that hasn’t been done already?

Thank you for the suggestion. I have already followed the Quickstart example and tested these changes on my end.

@arjunkshashicorp arjunkshashicorp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Comment thread internal/vault/client_test.go
Comment thread internal/proxy/proxy_test.go Outdated
Comment thread test/docker-compose.yaml
Comment thread internal/proxy/proxy_test.go Outdated
Comment thread internal/vault/client.go Outdated
Comment thread internal/vault/client.go

@arjunkshashicorp arjunkshashicorp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@stuti-sr stuti-sr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog is missing

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Comment thread internal/proxy/proxy_test.go
Comment thread internal/vault/client_test.go
Balaji2198
Balaji2198 previously approved these changes Jun 4, 2026
stuti-sr
stuti-sr previously approved these changes Jun 11, 2026

@stuti-sr stuti-sr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

…e specified instance type does not match the architecture arm64 of the specified AMI'
@bcsamrudh bcsamrudh dismissed stale reviews from stuti-sr, Balaji2198, and arjunkshashicorp via d580980 June 17, 2026 08:14

@stuti-sr stuti-sr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

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.

5 participants