...
1# AWS SDK for Go v2
2
3[](https://github.com/aws/aws-sdk-go-v2/actions/workflows/go.yml)[](https://github.com/aws/aws-sdk-go-v2/actions/workflows/codegen.yml) [](https://aws.github.io/aws-sdk-go-v2/docs/) [](https://aws.github.io/aws-sdk-go-v2/docs/migrating/) [](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) [](https://github.com/aws/aws-sdk-go-v2/blob/main/LICENSE.txt)
4
5`aws-sdk-go-v2` is the v2 AWS SDK for the Go programming language.
6
7The v2 SDK requires a minimum version of `Go 1.20`.
8
9Check out the [release notes](https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md) for information about the latest bug
10fixes, updates, and features added to the SDK.
11
12Jump To:
13* [Getting Started](#getting-started)
14* [Getting Help](#getting-help)
15* [Contributing](#feedback-and-contributing)
16* [More Resources](#resources)
17
18## Maintenance and support for SDK major versions
19
20For information about maintenance and support for SDK major versions and their underlying dependencies, see the
21following in the AWS SDKs and Tools Shared Configuration and Credentials Reference Guide:
22
23* [AWS SDKs and Tools Maintenance Policy](https://docs.aws.amazon.com/credref/latest/refdocs/maint-policy.html)
24* [AWS SDKs and Tools Version Support Matrix](https://docs.aws.amazon.com/credref/latest/refdocs/version-support-matrix.html)
25
26### Go version support policy
27
28The v2 SDK follows the upstream [release policy](https://go.dev/doc/devel/release#policy)
29with an additional six months of support for the most recently deprecated
30language version.
31
32**AWS reserves the right to drop support for unsupported Go versions earlier to
33address critical security issues.**
34
35## Getting started
36To get started working with the SDK setup your project for Go modules, and retrieve the SDK dependencies with `go get`.
37This example shows how you can use the v2 SDK to make an API request using the SDK's [Amazon DynamoDB] client.
38
39###### Initialize Project
40```sh
41$ mkdir ~/helloaws
42$ cd ~/helloaws
43$ go mod init helloaws
44```
45###### Add SDK Dependencies
46```sh
47$ go get github.com/aws/aws-sdk-go-v2/aws
48$ go get github.com/aws/aws-sdk-go-v2/config
49$ go get github.com/aws/aws-sdk-go-v2/service/dynamodb
50```
51
52###### Write Code
53In your preferred editor add the following content to `main.go`
54
55```go
56package main
57
58import (
59 "context"
60 "fmt"
61 "log"
62
63 "github.com/aws/aws-sdk-go-v2/aws"
64 "github.com/aws/aws-sdk-go-v2/config"
65 "github.com/aws/aws-sdk-go-v2/service/dynamodb"
66)
67
68func main() {
69 // Using the SDK's default configuration, loading additional config
70 // and credentials values from the environment variables, shared
71 // credentials, and shared configuration files
72 cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-west-2"))
73 if err != nil {
74 log.Fatalf("unable to load SDK config, %v", err)
75 }
76
77 // Using the Config value, create the DynamoDB client
78 svc := dynamodb.NewFromConfig(cfg)
79
80 // Build the request with its input parameters
81 resp, err := svc.ListTables(context.TODO(), &dynamodb.ListTablesInput{
82 Limit: aws.Int32(5),
83 })
84 if err != nil {
85 log.Fatalf("failed to list tables, %v", err)
86 }
87
88 fmt.Println("Tables:")
89 for _, tableName := range resp.TableNames {
90 fmt.Println(tableName)
91 }
92}
93```
94
95###### Compile and Execute
96```sh
97$ go run .
98Tables:
99tableOne
100tableTwo
101```
102
103## Getting Help
104
105Please use these community resources for getting help. We use the GitHub issues
106for tracking bugs and feature requests.
107
108* Ask us a [question](https://github.com/aws/aws-sdk-go-v2/discussions/new?category=q-a) or open a [discussion](https://github.com/aws/aws-sdk-go-v2/discussions/new?category=general).
109* If you think you may have found a bug, please open an [issue](https://github.com/aws/aws-sdk-go-v2/issues/new/choose).
110* Open a support ticket with [AWS Support](http://docs.aws.amazon.com/awssupport/latest/user/getting-started.html).
111
112This SDK implements AWS service APIs. For general issues regarding the AWS services and their limitations, you may also take a look at the [Amazon Web Services Discussion Forums](https://forums.aws.amazon.com/).
113
114### Opening Issues
115
116If you encounter a bug with the AWS SDK for Go we would like to hear about it.
117Search the [existing issues][Issues] and see
118if others are also experiencing the same issue before opening a new issue. Please
119include the version of AWS SDK for Go, Go language, and OS you’re using. Please
120also include reproduction case when appropriate.
121
122The GitHub issues are intended for bug reports and feature requests. For help
123and questions with using AWS SDK for Go please make use of the resources listed
124in the [Getting Help](#getting-help) section.
125Keeping the list of open issues lean will help us respond in a timely manner.
126
127## Feedback and contributing
128
129The v2 SDK will use GitHub [Issues] to track feature requests and issues with the SDK. In addition, we'll use GitHub [Projects] to track large tasks spanning multiple pull requests, such as refactoring the SDK's internal request lifecycle. You can provide feedback to us in several ways.
130
131**GitHub issues**. To provide feedback or report bugs, file GitHub [Issues] on the SDK. This is the preferred mechanism to give feedback so that other users can engage in the conversation, +1 issues, etc. Issues you open will be evaluated, and included in our roadmap for the GA launch.
132
133**Contributing**. You can open pull requests for fixes or additions to the AWS SDK for Go 2.0. All pull requests must be submitted under the Apache 2.0 license and will be reviewed by an SDK team member before being merged in. Accompanying unit tests, where possible, are appreciated.
134
135## Resources
136
137[SDK Developer Guide](https://aws.github.io/aws-sdk-go-v2/docs/) - Use this document to learn how to get started and
138use the AWS SDK for Go V2.
139
140[SDK Migration Guide](https://aws.github.io/aws-sdk-go-v2/docs/migrating/) - Use this document to learn how to migrate to V2 from the AWS SDK for Go.
141
142[SDK API Reference Documentation](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) - Use this
143document to look up all API operation input and output parameters for AWS
144services supported by the SDK. The API reference also includes documentation of
145the SDK, and examples how to using the SDK, service client API operations, and
146API operation require parameters.
147
148[Service Documentation](https://aws.amazon.com/documentation/) - Use this
149documentation to learn how to interface with AWS services. These guides are
150great for getting started with a service, or when looking for more
151information about a service. While this document is not required for coding,
152services may supply helpful samples to look out for.
153
154[Forum](https://forums.aws.amazon.com/forum.jspa?forumID=293) - Ask questions, get help, and give feedback
155
156[Issues] - Report issues, submit pull requests, and get involved
157 (see [Apache 2.0 License][license])
158
159[Dep]: https://github.com/golang/dep
160[Issues]: https://github.com/aws/aws-sdk-go-v2/issues
161[Projects]: https://github.com/aws/aws-sdk-go-v2/projects
162[CHANGELOG]: https://github.com/aws/aws-sdk-go-v2/blob/main/CHANGELOG.md
163[Amazon DynamoDB]: https://aws.amazon.com/dynamodb/
164[design]: https://github.com/aws/aws-sdk-go-v2/blob/main/DESIGN.md
165[license]: http://aws.amazon.com/apache2.0/
View as plain text