Skip to content

Commit 3c66a12

Browse files
committed
Update README with install/config guide and sample code
1 parent 480a6a5 commit 3c66a12

File tree

3 files changed

+76
-27
lines changed

3 files changed

+76
-27
lines changed

LICENSE renamed to LICENSE.txt

File renamed without changes.

NOTICE renamed to NOTICE.txt

File renamed without changes.

README.md

+76-27
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,97 @@
22

33
[![GoDoc](http://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/awslabs/aws-sdk-go)
44
[![Build Status](https://img.shields.io/travis/awslabs/aws-sdk-go.svg)](https://travis-ci.org/awslabs/aws-sdk-go)
5-
[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/awslabs/aws-sdk-go/blob/master/LICENSE)
5+
[![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/awslabs/aws-sdk-go/blob/master/LICENSE.txt)
66

7-
aws-sdk-go is a set of clients for all Amazon Web Services APIs,
8-
automatically generated from the JSON schemas shipped with
9-
[botocore](http://github.com/boto/botocore).
10-
11-
It supports all known AWS services, and maps exactly to the documented
12-
APIs, with some allowances for Go-specific idioms (e.g. `ID` vs. `Id`).
7+
aws-sdk-go is the official AWS SDK for the Go programming language.
138

149
## Caution
1510

16-
It is currently **highly untested**, so please be patient and report any
17-
bugs or problems you experience. The APIs may change radically without
18-
much warning, so please vendor your dependencies w/ Godep or similar.
11+
The SDK is currently in the process of being developed, and not everything
12+
may be working fully yet. Please be patient and report any bugs or problems
13+
you experience. The APIs may change radically without much warning, so please
14+
vendor your dependencies with Godep or similar.
1915

2016
Please do not confuse this for a stable, feature-complete library.
2117

22-
Note that many services are currently not fully implemented. Some operations
23-
might work, but not all, especially for XML-based services. We are currently
24-
working to build out better service support, please bear with us!
18+
Note that while most AWS protocols are currently supported, not all services
19+
available in this package are implemented fully, as some require extra
20+
customizations to work with the SDK. If you've encountered such a scenario,
21+
please open a [GitHub issue](https://github.com/awslabs/aws-sdk-go/issues)
22+
so we can track work for the service.
2523

2624
## Installing
2725

28-
Let's say you want to use EC2:
26+
Install your specific service package with the following `go get` command.
27+
For example, EC2 support might be installed with:
2928

3029
$ go get github.com/awslabs/aws-sdk-go/service/ec2
31-
32-
**NOTE**: If you are trying to use the development branch, after performing the command above, you must additionally check out the development branch:
33-
34-
$ cd $GOPATH/src/github.com/awslabs/aws-sdk-go; git checkout develop
30+
31+
You can also install the entire SDK by installing the root package:
32+
33+
$ go get github.com/awslabs/aws-sdk-go/service/ec2
34+
35+
## Configuring Credentials
36+
37+
Before using the SDK, ensure that you've configured credentials. The best
38+
way to configure credentials on a development machine is to use the
39+
`~/.aws/credentials` file, which might look like:
40+
41+
```
42+
[default]
43+
aws_access_key_id = AKID1234567890
44+
aws_secret_access_key = MY-SECRET-KEY
45+
```
46+
47+
You can learn more about the credentials file from this
48+
[blog post](http://blogs.aws.amazon.com/security/post/Tx3D6U6WSFGOK2H/A-New-and-Standardized-Way-to-Manage-Credentials-in-the-AWS-SDKs).
3549

3650
## Using
3751

52+
To use a service in the SDK, create a service variable by calling the `New()`
53+
function. Once you have a service, you can call API operations which each
54+
return response data and a possible error.
55+
56+
To list a set of instance IDs from EC2, you could run:
57+
3858
```go
39-
import "github.com/awslabs/aws-sdk-go/aws"
40-
import "github.com/awslabs/aws-sdk-go/service/ec2"
41-
42-
creds := aws.Creds(accessKey, secretKey, "")
43-
cli := ec2.New(creds, "us-west-2", nil)
44-
resp, err := cli.DescribeInstances(nil)
45-
if err != nil {
46-
panic(err)
59+
package main
60+
61+
import (
62+
"fmt"
63+
64+
"github.com/awslabs/aws-sdk-go/aws"
65+
"github.com/awslabs/aws-sdk-go/service/ec2"
66+
)
67+
68+
func main() {
69+
// Create an EC2 service object in the "us-west-2" region
70+
// Note that you can also configure your region globally by
71+
// exporting the AWS_REGION environment variable
72+
svc := ec2.New(&aws.Config{Region: "us-west-2"})
73+
74+
// Call the DescribeInstances Operation
75+
resp, err := svc.DescribeInstances(nil)
76+
if err != nil {
77+
panic(err)
78+
}
79+
80+
// resp has all of the response data, pull out instance IDs:
81+
fmt.Println("> Number of reservation sets: ", len(resp.Reservations))
82+
for _, res := range resp.Reservations {
83+
fmt.Println(" > Number of instances: ", len(res.Instances))
84+
for _, inst := range resp.Reservations[0].Instances {
85+
fmt.Println(" - Instance ID: ", *inst.InstanceID)
86+
}
87+
}
4788
}
48-
fmt.Println(resp.Reservations)
4989
```
90+
91+
You can find more information and operations in our
92+
[API documentation](http://godoc.org/github.com/awslabs/aws-sdk-go).
93+
94+
## License
95+
96+
This SDK is distributed under the
97+
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
98+
see LICENSE.txt and NOTICE.txt for more information.

0 commit comments

Comments
 (0)