1# AWS SDK for Go v2 2 3[![Build Status](https://travis-ci.com/aws/aws-sdk-go-v2.svg?branch=main)](https://travis-ci.com/aws/aws-sdk-go-v2) [![SDK Documentation](https://img.shields.io/badge/SDK-Documentation-blue)](https://aws.github.io/aws-sdk-go-v2/docs/) [![API Reference](https://img.shields.io/badge/api-reference-blue.svg)](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](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 8The v2 SDK requires a minimum version of `Go 1.15`. 9 10Checkout out the [release notes](https://github.com/aws/aws-sdk-go-v2/releases) for information about the latest bug 11fixes, updates, and features added to the SDK. 12 13Jump 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 21For information about maintenance and support for SDK major versions and their underlying dependencies, see the 22following 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 28To get started working with the SDK setup your project for Go modules, and retrieve the SDK dependencies with `go get`. 29This 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 45In your preferred editor add the following content to `main.go` 46 47```go 48package main 49 50import ( 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 60func 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 . 90Table: 91tableOne 92tableTwo 93``` 94 95## Getting Help 96 97Please use these community resources for getting help. We use the GitHub issues 98for 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 104This 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 108If you encounter a bug with the AWS SDK for Go we would like to hear about it. 109Search the [existing issues][Issues] and see 110if others are also experiencing the issue before opening a new issue. Please 111include the version of AWS SDK for Go, Go language, and OS you’re using. Please 112also include reproduction case when appropriate. 113 114The GitHub issues are intended for bug reports and feature requests. For help 115and questions with using AWS SDK for Go please make use of the resources listed 116in the [Getting Help](#getting-help) section. 117Keeping the list of open issues lean will help us respond in a timely manner. 118 119## Feedback and contributing 120 121The 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 130use the AWS SDK for Go V2. 131 132[SDK API Reference Documentation](https://pkg.go.dev/mod/github.com/aws/aws-sdk-go-v2) - Use this 133document to look up all API operation input and output parameters for AWS 134services supported by the SDK. The API reference also includes documentation of 135the SDK, and examples how to using the SDK, service client API operations, and 136API operation require parameters. 137 138[Service Documentation](https://aws.amazon.com/documentation/) - Use this 139documentation to learn how to interface with AWS services. These guides are 140great for getting started with a service, or when looking for more 141information about a service. While this document is not required for coding, 142services may supply helpful samples to look out for. 143 144[Forum](https://forums.aws.amazon.com/forum.jspa?forumID=293) - Ask questions, get help, and give feedback 145 146[Issues] - Report issues, submit pull requests, and get involved 147 (see [Apache 2.0 License][license]) 148 149[Dep]: https://github.com/golang/dep 150[Issues]: https://github.com/aws/aws-sdk-go-v2/issues 151[Projects]: https://github.com/aws/aws-sdk-go-v2/projects 152[CHANGELOG]: https://github.com/aws/aws-sdk-go-v2/blob/master/CHANGELOG.md 153[Amazon DynamoDB]: https://aws.amazon.com/dynamodb/ 154[design]: https://github.com/aws/aws-sdk-go-v2/blob/master/DESIGN.md 155[license]: http://aws.amazon.com/apache2.0/ 156