Repository navigation
Migrate from aws-sdk-go v1 to aws-sdk-go-v2 - #9
Merged
Merged
Conversation
Replace the deprecated aws-sdk-go v1 SDK with aws-sdk-go-v2 across all quota checks (EC2, ASG, Lambda, ELBv2, IAM, Service Quotas), including context-aware paginators, NewFromConfig clients, and regenerated mocks. Set WithRetryMaxAttempts(10) on the shared config: the Service Quotas API has a low request rate limit and the exporter calls ListServiceQuotas once per service, so the v2 standard retryer's default of 3 attempts surfaced TooManyRequestsException under normal scrapes. Raising the attempt ceiling lets the SDK back off through throttling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the quota/usage checks from aws-sdk-go v1 to aws-sdk-go-v2, updating clients, paginators, and mocks, and bumps the project to Go 1.24 to support the updated SDK/tooling.
Changes:
- Replace v1 AWS service clients/interfaces with v2
NewFromConfigclients and context-aware paginators across EC2/VPC/VPC endpoints/ASG/Lambda/ELBv2/IAM/Service Quotas. - Regenerate/update mocks and unit tests to use v2 API shapes (
types.*) and request signatures (context.Context+ options). - Update build/runtime dependencies: Go 1.24 in
go.modand Docker builder image, plus v2 SDK modules ingo.mod/go.sum.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| servicequotas/vpc_limits.go | Migrate VPC/EIP usage checks to EC2 v2 client + paginator usage. |
| servicequotas/vpc_limits_test.go | Update VPC/EIP tests to v2 shapes and mock behaviors. |
| servicequotas/vpc_endpoint_limits.go | Migrate VPC endpoint counting/checks to EC2 v2 paginator + v2 endpoint type enums. |
| servicequotas/vpc_endpoint_limits_test.go | Update VPC endpoint tests to v2 shapes/enums. |
| servicequotas/service_quotas.go | Migrate Service Quotas client creation to v2 config; implement v2 paginator usage; update region/partition handling. |
| servicequotas/service_quotas_test.go | Update service quotas tests/mocks to v2 interfaces and types. |
| servicequotas/nlb_limits.go | Migrate ELBv2 NLB usage check to v2 client + paginator. |
| servicequotas/nlb_limits_test.go | Update NLB tests to v2 ELBv2 types. |
| servicequotas/mock_iam_client.go | Update IAM mock to v2 method signatures and output types. |
| servicequotas/mock_elbv2_client.go | Update ELBv2 mock to v2 method signatures and output types. |
| servicequotas/mock_ec2_client.go | Update EC2 mock to v2 method signatures and output types; capture filters in v2 form. |
| servicequotas/mock_autoscaling_client.go | Update ASG mock to v2 method signature and output types. |
| servicequotas/lambda_limits.go | Migrate Lambda account settings usage check to v2 client signature and output shapes. |
| servicequotas/lambda_limits_test.go | Update Lambda tests to v2 shapes/types. |
| servicequotas/iam_limits.go | Migrate IAM usage checks to v2 paginators + v2 policy scope enum. |
| servicequotas/iam_limits_test.go | Update IAM tests to v2 shapes/enums and mock expectations. |
| servicequotas/ec2_limits.go | Migrate EC2-backed usage checks to v2 paginators and v2 request/shape types. |
| servicequotas/ec2_limits_test.go | Update EC2 usage-check tests to v2 types and filter shapes. |
| servicequotas/asg_limits.go | Migrate ASG usage check to v2 paginator + v2 instance lifecycle state type. |
| servicequotas/asg_limits_test.go | Update ASG tests to v2 shapes/enums. |
| go.mod | Bump Go version and replace v1 SDK dependency with v2 module set. |
| go.sum | Refresh dependency checksums to match v2 SDK and updated indirect deps. |
| build/Dockerfile | Update build image to Go 1.24 Alpine image. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
behebot
approved these changes
Jun 5, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Map us-iso-* to aws-iso and us-isob-* to aws-iso-b, including their global Service Quotas regions, so ISO-partition regions resolve to the correct partition instead of falling through to the default aws partition. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aws-sdk-gov1 toaws-sdk-go-v2(EC2, ASG, Lambda, ELBv2, IAM, Service Quotas) — context-aware paginators,NewFromConfigclients, and regenerated mocks. Bumps Go to 1.24.config.WithRetryMaxAttempts(10)on the shared config. The Service Quotas API has a low request rate limit and the exporter callsListServiceQuotasonce per service, so the v2 standard retryer's default of 3 attempts surfacedTooManyRequestsExceptionduring normal scrapes. Raising the ceiling lets the SDK back off through throttling.Test plan
go build ./cmdgo test ./...— all packages passus-west-2with default checks: ~3,410 metrics, no throttling.us-west-2and validated the expected metric family appears with no errors/throttling:--enable-vpc-endpoints→*_vpc_endpoints_per_vpc--enable-vpcs-per-region→vpcs_per_region--enable-eips-per-region→eips_per_region--enable-nlbs-per-region→nlbs_per_region--enable-iam-roles-per-account→iam_roles_per_account--enable-iam-policies-per-account→iam_policies_per_account🤖 Generated with Claude Code