You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-43Lines changed: 52 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# AWS SDK for Go v2
2
2
3
-
[](https://docs.aws.amazon.com/sdk-for-go/v2/api)[](https://gitter.im/aws/aws-sdk-go-v2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt)
`aws-sdk-go-v2` is the **Developer Preview** (aka **beta**) for the v2 AWS SDK for the Go programming language. This Developer Preview is provided to receive feedback from the language community on SDK changes prior to the final release. As such users should expect the SDK to release minor version releases that break backwards compatability. The release notes for the breaking change will include information about the breaking change, and how you can migrate to the latest version.
@@ -12,7 +12,6 @@ We'll be expanding out the [Issues] and [Projects] sections with additional chan
12
12
Jump To:
13
13
*[Project Status](_#Project-Status_)
14
14
*[Getting Started](_#Getting-Started_)
15
-
*[Quick Examples](_#Quick-Examples_)
16
15
*[Getting Help](_#Getting-Help_)
17
16
*[Contributing](_#Feedback-and-contributing_)
18
17
*[More Resources](_#Resources_)
@@ -33,63 +32,73 @@ Users should expect significant changes that could affect the following (non-exh
33
32
* Minimum Supported Go Release following the [Language Release Policy](https://golang.org/doc/devel/release.html#policy)
34
33
35
34
## Getting started
35
+
To get started working with the SDK setup your project for Go modules, and retrieve the SDK dependencies with `go get`.
36
+
This example shows how you can use the v2 SDK to make an API request using the SDK's [Amazon DynamoDB] client.
36
37
37
-
To get started working with the SDK is to use `go get` to add the SDK to your application dependencies using Go modules.
38
-
38
+
###### Initialize Project
39
39
```sh
40
-
go get github.com/aws/aws-sdk-go-v2
41
-
go get github.com/aws/aws-sdk-go-v2/service/dynamodb
40
+
$ mkdir ~/helloaws
41
+
$ cd~/helloaws
42
+
$ go mod init helloaws
43
+
```
44
+
###### Add SDK Dependencies
45
+
```sh
46
+
$ go get github.com/aws/aws-sdk-go-v2/aws
47
+
$ go get github.com/aws/aws-sdk-go-v2/aws/config
48
+
$ go get github.com/aws/aws-sdk-go-v2/service/dynamodb
42
49
```
43
50
44
-
## Quick Examples
45
-
46
-
### Hello AWS
47
-
48
-
This example shows how you can use the v2 SDK to make an API request using the SDK's [Amazon DynamoDB] client.
51
+
###### Write Code
52
+
In your preferred editor add the following content to `main.go`
49
53
50
54
```go
51
55
package main
52
56
53
57
import (
54
-
"context"
55
-
"fmt"
58
+
"context"
59
+
"fmt"
60
+
"log"
56
61
57
-
"github.com/aws/aws-sdk-go-v2/aws"
58
-
"github.com/aws/aws-sdk-go-v2/config"
59
-
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
62
+
"github.com/aws/aws-sdk-go-v2/aws"
63
+
"github.com/aws/aws-sdk-go-v2/config"
64
+
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
60
65
)
61
66
62
67
funcmain() {
63
-
// Using the SDK's default configuration, loading additional config
64
-
// and credentials values from the environment variables, shared
65
-
// credentials, and shared configuration files
66
-
cfg, err:= config.LoadDefaultConfig()
67
-
if err != nil {
68
-
panic("unable to load SDK config, " + err.Error())
69
-
}
70
-
71
-
// Set the AWS Region that the service clients should use
72
-
cfg.Region = "us-west-2"
73
-
74
-
// Using the Config value, create the DynamoDB client
0 commit comments