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