Releases: aws/aws-sdk-go-v2
Release 2020-09-30
Service Client Highlights
- Service clients have been bumped to
v0.26.0
simplify the documentation experience when using pkg.go.dev. service/s3
: Disable automatic decompression of getting Amazon S3 objects with theContent-Encoding: gzip
metadata header. (#748)- This changes the SDK's default behavior with regard to making S3 API calls. The client will no longer automatically set the
Accept-Encoding
HTTP request header, nor will it automatically decompress the gzipped response when theContent-Encoding: gzip
response header was received. - If you'd like the client to sent the
Accept-Encoding: gzip
request header, you can add this header to the API operation method call with the SetHeaderValue. middleware helper.
- This changes the SDK's default behavior with regard to making S3 API calls. The client will no longer automatically set the
service/cloudfront/sign
: Fix cloudfront example usage of SignWithPolicy (#673)- Fixes #671 documentation typo by correcting the usage of
SignWithPolicy
.
- Fixes #671 documentation typo by correcting the usage of
Core SDK Highlights
- SDK core module released at
v0.26.0
config
module released atv0.1.1
credentials
module released atv0.1.1
ec2imds
module released atv0.1.1
Release 2020-09-28
Announcements
We’re happy to share the updated clients for the v0.25.0 preview version of the AWS SDK for Go V2.
The updated clients leverage new developments and advancements within AWS and the Go software ecosystem at large since
our original preview announcement. Using the new clients will be a bit different than before. The key differences are:
simplified API operation invocation, performance improvements, support for error wrapping, and a new middleware architecture.
So below we have a guided walkthrough to help try it out and share your feedback in order to better influence the features
you’d like to see in the GA version.
See Announcement Blog Post for more details.
Service Client Highlights
- Initial service clients released at version
v0.1.0
Core SDK Highlights
- SDK core module released at
v0.25.0
config
module released atv0.1.0
credentials
module released atv0.1.0
ec2imds
module released atv0.1.0
Migrating from v2 preview SDK's v0.24.0 to v0.25.0
Design changes
The v2 preview SDK v0.25.0
release represents a significant stepping stone bringing the v2 SDK closer to its target design and usability. This release includes significant breaking changes to the v2 preview SDK. The updates in the v0.25.0
release focus on refactoring and modularization of the SDK’s API clients to use the new client design, updated request pipeline (aka middleware), refactored credential providers, and configuration loading packages.
We've also bumped the minimum supported Go version with this release. Starting with v0.25.0 the SDK requires a minimum version of Go v1.15
.
As a part of the refactoring done to v2 preview SDK some components have not been included in this update. The following is a non exhaustive list of features that are not available.
- API Paginators - #439
- API Waiters - #442
- Presign URL - #794
- Amazon S3 Upload and Download manager - #802
- Amazon DynamoDB's AttributeValue marshaler, and Expression package - #790
- Debug Logging - #594
We expect additional breaking changes to the v2 preview SDK in the coming releases. We expect these changes to focus on organizational, naming, and hardening the SDK's design for future feature capabilities after it is released for general availability.
Relocated Packages
In this release packages within the SDK were relocated, and in some cases those packages were converted to Go modules. The following is a list of packages have were relocated.
github.com/aws/aws-sdk-go-v2/aws/external
=>github.com/aws/aws-sdk-go-v2/config
modulegithub.com/aws/aws-sdk-go-v2/aws/ec2metadata
=>github.com/aws/aws-sdk-go-v2/ec2imds
module
The github.com/aws/aws-sdk-go-v2/credentials
module contains refactored credentials providers.
github.com/aws/aws-sdk-go-v2/ec2rolecreds
=>github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds
github.com/aws/aws-sdk-go-v2/endpointcreds
=>github.com/aws/aws-sdk-go-v2/credentials/endpointcreds
github.com/aws/aws-sdk-go-v2/processcreds
=>github.com/aws/aws-sdk-go-v2/credentials/processcreds
github.com/aws/aws-sdk-go-v2/stscreds
=>github.com/aws/aws-sdk-go-v2/credentials/stscreds
Modularization
New modules were added to the v2 preview SDK to allow the components to be versioned independently from each other. This allows your application to depend on specific versions of an API client module, and take discrete updates from the SDK core and other API client modules as desired.
- github.com/aws/aws-sdk-go-v2/config
- github.com/aws/aws-sdk-go-v2/credentials
- Module for each API client, e.g. github.com/aws/aws-sdk-go-v2/service/s3
API Clients
The following is a list of the major changes to the API client modules
- Removed paginators: we plan to add these back once they are implemented to integrate with the SDK's new API client design.
- Removed waiters: we need to further investigate how the V2 SDK should expose waiters, and how their behavior should be modeled.
- API Clients are now Go modules. When migrating to the v2 preview SDK
v0.25.0
, you'll need to add the API client's module to your application's go.mod file. - API parameter nested types have been moved to a
types
package within the API client's module, e.g.github.com/aws/aws-sdk-go-v2/service/s3/types
These types were moved to improve documentation and discovery of the API client, operation, and input/output types. For example Amazon S3's ListObject's operation ListObjectOutput.Contents input parameter is a slice of types.Object. - The client operation method has been renamed, removing the
Request
suffix. The method now invokes the operation instead of constructing a request, which needed to be invoked separately. The operation methods were also expanded to include functional options for providing operation specific configuration, such as modifying the request pipeline.
result, err := client.Scan(context.TODO(), &dynamodb.ScanInput{
TableName: aws.String("exampleTable"),
}, func(o *Options) {
// Limit operation calls to only 1 attempt.
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, 1)
})
Configuration
In addition to the github.com/aws/aws-sdk-go-v2/aws/external
package being made a module at github.com/aws/aws-sdk-go-v2/config
, the LoadDefaultAWSConfig
function was renamed to LoadDefaultConfig
.
The github.com/aws/aws-sdk-go-v2/aws/defaults
package has been removed. Its components have been migrated to the github.com/aws/aws-sdk-go-v2/aws
package, and github.com/aws/aws-sdk-go-v2/config
module.
Error Handling
The github.com/aws/aws-sdk-go-v2/aws/awserr
package was removed as a part of the SDK error handling refactor. The SDK now uses typed errors built around Go v1.13's errors.As and errors.Unwrap features. All SDK error types that wrap other errors implement the Unwrap
method. Generic v2 preview SDK errors created with fmt.Errorf
use %w
to wrap the underlying error.
The SDK API clients now include generated public error types for errors modeled for an API. The SDK will automatically deserialize the error response from the API into the appropriate error type. Your application should use errors.As
to check if the returned error matches one it is interested in. Your application can also use the generic interface smithy.APIError to test if the API client's operation method returned an API error, but not check against a specific error.
API client errors returned to the caller will use error wrapping to layer the error values. This allows underlying error types to be specific to their use case, and the SDK's more generic error types to wrap the underlying error.
For example, if an Amazon DynamoDB Scan operation call cannot find the TableName
requested, the error returned will contain dynamodb.ResourceNotFoundException. The SDK will return this error value wrapped in a couple layers, with each layer adding additional contextual information such as ResponseError for AWS HTTP response error metadata , and smithy.OperationError for API operation call metadata.
result, err := client.Scan(context.TODO(), params)
if err != nil {
// To get a specific API error
var notFoundErr *types.ResourceNotFoundException
if errors.As(err, ¬FoundErr) {
log.Printf("scan failed because the table was not found, %v",
notFoundErr.ErrorMessage())
}
// To get any API error
var apiErr smithy.APIError
if errors.As(err, &apiErr) {
log.Printf("scan failed because of an API error, Code: %v, Message: %v",
apiErr.ErrorCode(), apiErr.ErrorMessage())
}
// To get the AWS response metadata, such as RequestID
var respErr *awshttp.ResponseError // Using import alias "awshttp" for package github.com/aws/aws-sdk-go-v2/aws/transport/http
if errors.As(err, &respErr) {
log.Printf("scan failed with HTTP status code %v, Request ID %v and error %v",
respErr.HTTPStatusCode(), respErr.ServiceRequestID(), respErr)
}
return err
}
Logging an error value will include information from each wrapped error. For example, the following is a mock error logged for a Scan operation call that failed because the table was not found.
2020/10/15 16:03:37 operation error DynamoDB: Scan, https response error StatusCode: ...
Release v0.24.0 (2020-07-21)
Announcements
- Since February 2020 the team for the AWS SDK for Go have been working to reimagine and modernize the SDK to take advantage of exciting new developments within AWS. We have been working towards supporting the Smithy protocol agnostic modeling language. While implementing support we have taken the opportunity to make significant changes to our client interfaces, middleware, and configuration.
- This release will mark the final release using the current SDK design. Starting with the next release we will remove clients using the former design, and will re-introduce clients in subsequent releases as we add support for their protocols and customizations.
- We encourage our community of users to provide feedback, bug reports, and feature requests via Github Issues as we introduce the new clients and design over the next set of releases.
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Bugs
Release v0.23.0 (2020-05-28)
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Enhancements
aws/stscreds
:PolicyArns
can now be passed in tostscreds.AssumeRoleProvider
andstscreds.WebIdentityRoleProvider
in the same way assts.AssumeRoleInput
.
SDK Bugs
aws/defaults
: Fix handling of unexpected Date response header value (#560)- Fixes the SDK's behavior to parse unexpected HTTP Date header received that was formated with single digit day of the month instead of two digit RFC822 datetime like defined in RFC 2616. This should prevent log messages about unable to compute clock skew.
- Fixes #556
service/s3
: Fix S3 client behavior wrt 200 OK response with empty payload
Release v0.22.0 (2020-04-27)
Services
- Synced the V2 SDK with latest AWS service API definitions.
Breaking Changes
- Removed prototype and experiment types from master branch of SDK.
Release v0.21.0 (2020-04-21)
Breaking Change
aws/endpoints
: Several functions and types have been removedservice/s3/s3crypto
: Package and associated encryption/decryption clients have been removed from the SDK (#511)aws/external
: Removes several export constants and types (#508)- No longer exports AWS environment constants used by the external environment configuration loader
DefaultSharedConfigProfile
is now defined an exported constant
aws
:ErrMissingRegion
,ErrMissingEndpoint
,ErrStaticCredentialsEmpty
are now concrete error types (#510)
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Features
aws/signer/v4
: New methodsSignHTTP
andPresignHTTP
have been added (#519)SignHTTP
replacesSign
, and usage ofSign
should be migrated before it's removal at a later datePresignHTTP
replacesPresign
, and usage ofPresign
should be migrated before it's removal at a later dateDisableRequestBodyOverwrite
andUnsignedPayload
are now deprecated options and have no effect onSignHTTP
orPresignHTTP
. These options will be removed at a later date.
aws/external
: Add Support for setting a default fallback region and resolving region from EC2 IMDS (#523)WithDefaultRegion
helper has been added which can be passed toLoadDefaultAWSConfig
- This helper can be used to configure a default fallback region in the event a region fails to be resolved from other sources
- Support has been added to resolve region using EC2 IMDS when available
- The IMDS region will be used if region as not found configured in either the shared config or the process environment.
- Fixes #244
- Fixes #515
SDK Enhancements
service/dynamodb/expression
: Add IsSet helper for ConditionBuilder and KeyConditionBuilder (#494)- Adds a IsSet helper for ConditionBuilder and KeyConditionBuilder to make it easier to determine if the condition builders have any conditions added to them.
- Implements #493.
internal/ini
: Normalize Section keys to lowercase (#495)- Update's SDK's ini utility to store all keys as lowercase. This brings the SDK inline with the AWS CLI's behavior.
SDK Bugs
internal/sdk
: Fix SDK's UUID utility to handle partial read (#536)- Fixes the SDK's UUID utility to correctly handle partial reads from its crypto rand source. This error was sometimes causing the SDK's InvocationID value to fail to be obtained, due to a partial read from crypto.Rand.
- Fix #534
aws/defaults
: Fix request metadata headers causing signature errors (#536)- Fixes the SDK's adding the request metadata headers in the wrong location within the request handler stack. This created a situation where a request that was retried would sign the new attempt using the old value of the header. The header value would then be changed before sending the request.
- Fix #533
- Fix #521
Release v0.20.0 (2020-03-17)
Breaking Change
- Update SDK retry behavior
- Significant updates were made the SDK's retry behavior. The SDK will now retry all connections error. In addition, to changing what errors are retried the SDK's retry behavior not distinguish the difference between throttling errors, and regular retryable errors. All errors will be retried with the same backoff jitter delay scaling.
- The SDK will attempt an operation request 3 times by default. This is one less than the previous initial request with 3 retires.
- New helper functions in the new
aws/retry
package allow wrapping aRetrier
with custom behavior, overriding the baseRetrier
, (e.g.AddWithErrorCodes
, andAddWithMaxAttempts
)
- Update SDK error handling
- Updates the SDK's handling of errors to take advantage of Go 1.13's new
errors.As
,Is
, andUnwrap
. The SDK's errors were updated to satisfy theUnwrap
interface, returning the underlying error. - With this update, you can now more easily access the SDK's layered errors, and meaningful state such as,
Timeout
,Temporary
, and other states added to the SDK such asCanceledError
.
- Updates the SDK's handling of errors to take advantage of Go 1.13's new
- Bump SDK minimum supported version from Go 1.12 to Go 1.13
- The SDK's minimum supported version is bumped to take advantage of Go 1.13's updated
errors
package.
- The SDK's minimum supported version is bumped to take advantage of Go 1.13's updated
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Features
aws
: Add Support for additional credential providers and credential configuration chaining (#488)aws/awserr
: Adds support for Go 1.13'serrors.Unwrap
(#487)aws
: Updates SDK retry behavior (#487)aws/retry
: New package defining logic to determine if a request should be retried, and backoff.aws/ratelimit
: New package defining rate limit logic such as token bucket used by theretry.Standard
retrier.
SDK Enhancements
aws
: Add grouping of concurrent refresh of credentials (#503)- Concurrent calls to
Retrieve
are now grouped in order to prevent numerous synchronous calls to refresh the credentials. Replacing the mutex with a singleflight reduces the overall amount of time request signatures need to wait while retrieving credentials. This is improvement becomes pronounced when many requests are made concurrently.
- Concurrent calls to
service/s3/s3manager
: Improve memory allocation behavior by replacing sync.Pool with custom pool implementation- Improves memory allocations that occur when the provided
io.Reader
to upload does not satisfy both theio.ReaderAt
andio.ReadSeeker
interfaces.
- Improves memory allocations that occur when the provided
SDK Bugs
service/s3/s3manager
: Fix resource leaks when the following occurred:- Failed CreateMultipartUpload call
- Failed UploadPart call
Release v0.19.0 (2020-01-30)
Breaking Change
service
: Add generated service for wafregional and dynamodbstreams #463- Updates the wafregional and dynamodbstreams API clients to include all API operations, and types that were previously shared between waf and dynamodb API clients respectively. This update ensures that all API clients include all operations and types needed for that client, and shares no types with another client package.
- To migrate your applications to use the updated wafregional and dynamodbstreams you'll need to update the package the impacted type is imported from to match the client the type is being used with.
aws
: Context has been added to EC2Metadata operations.(#461)- Also updates utilities that directly or indirectly depend on EC2Metadata client. Signer utilities, credential providers now take in context.
private/model
: Add utility for validating shape names for structs and enums for the service packages (#471)- Fixes bug which allowed service package structs, enums to start with non alphabetic character
- Fixes the incorrect enum types in mediapackage service package, changing enum types __AdTriggersElement, __PeriodTriggersElement to AdTriggersElement, PeriodTriggersElement respectively.
aws
: Client, Metadata, and Request structures have been refactored to simplify the usage of resolved endpoints (#473)aws.Client.Endpoint
struct member has been removed, andaws.Request.Endpoint
struct member has been added of typeaws.Endpoint
aws.Client.Region
structure member has been removed
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Features
aws
:PartitionID
has been added toaws.Endpoint
structure, and is used by the endpoint resolver to indicate which AWS partition an endpoint was resolved for (#473)aws/endpoints
: Updated resolvers to populatePartitionID
for a resolvedaws.Endpoint
(#473)service/s3
: Add support for Access Point resources- Adds support for using Access Point resource with Amazon S3 API operation calls. The Access Point resource are identified by an Amazon Resource Name (ARN).
- To make operation calls to an S3 Access Point instead of a S3 Bucket, provide the Access Point ARN string as the value of the Bucket parameter. You can create an Access Point for your bucket with the Amazon S3 Control API. The Access Point ARN can be obtained from the S3 Control API. You should avoid building the ARN directly.
SDK Enhancements
internal/sdkio
: Adds RingBuffer data structure to the sdk #417- Adds an implementation of RingBuffer data structure which acts as a revolving buffer of a predefined length. The RingBuffer implements io.ReadWriter interface.
- Adds unit tests to test the behavior of the ring buffer.
aws/ec2metadata
: Adds support for EC2Metadata client to use secure tokens provided by the IMDS (#453)- Modifies EC2Metadata client to use request context within its operations (#462)
- Reduces the default dialer timeout and response header timeout to help reduce latency for known issues with EC2Metadata client running inside a container
- Modifies and adds tests to verify the behavior of the EC2Metadata client.
service/dynamodb/dynamodbattribute
: Adds clarifying docs on dynamodbattribute.UnixTime (#464)example/service/sts/assumeRole
: added sts assume role example (#224)- Fixes #157 by adding an example for Amazon STS assume role to retrieve credentials.
SDK Bugs
Release v0.18.0 (2019-12-12)
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Bugs
aws/endpoints
: aws/endpoints: Fix SDK resolving endpoint without region (#420)- Fixes the SDK's endpoint resolve incorrectly resolving endpoints for a service when the region is empty. Also fixes the SDK attempting to resolve a service when the service value is empty.
- Related to aws/aws-sdk-go#2909
Release v0.17.0 (2019-11-20)
Services
- Synced the V2 SDK with latest AWS service API definitions.
SDK Enhancements
- SDK minimum version requirement has been updated to Go 1.12 (#432)