The AWS SDK for Go is now live and ready for developers to build productive applications with using the Go programming language. This session will show you how to get started using the AWS SDK for Go. We’ll introduce the best practices for how to use the SDK, and how it integrates with your Go application. We will explore an example application which uses async programming with Amazon S3 and Amazon SQS to distribute tasks across multiple concurrent goroutines, and use Amazon Elastic Beanstalk to deploy and scale the application.
3. History of AWS SDK for Go
• Based on Stripe's aws-go
• January 2015: AWS took over
• June 2015: Developer Preview
• Soon: GA!
4. AWS SDK for Go
Source: https://github.com/aws/aws-sdk-go
5. AWS SDK for Go
Getting started: https://github.com/aws/aws-sdk-go/wiki
6. AWS SDK for Go
API docs: http://docs.aws.amazon.com/sdk-for-go/api/
7. What to expect from the session
• Get started with the AWS SDK for Go
• Build concurrent application with the SDK
• Deploy and scale the application
8. Go get the AWS SDK for Go
• Get the SDK
• go get -u github.com/aws/aws-sdk-go/...
• Tagged release versioning
• e.g. “v0.9.9”
9. Structure of AWS SDK for Go
• import "github.com/aws/aws-sdk-go/aws"
• Utilities tools
• Configuration
• import "github.com/aws/aws-sdk-go/service/s3"
• Service client
• API operations
• API request/response structs
10. Configuration for AWS SDK for Go
• Requires region and AWS credentials.
• Service clients are given a configuration that is merged
with the default configuration. Specify only what you
need.
• Create unique service client instances with different
configurations.
11. Configuration: credentials
• NEVER put AWS credentials in your code.
• Credentials provider chain:
1. Environment variables
2. Shared credentials file
3. EC2 instance profile
credentials
12. Credentials: shared credentials file
• Default file, ~/.aws/credentials
• Shared by all SDKs and AWS CLI
• Multiple sets of credentials as profiles
• AWS_PROFILE specifies profile
14. AWS SDK for Go: Making requests
Relying on credential provider
and AWS_REGION
15. What to expect from the session
• Get started with the AWS SDK for Go
• Build concurrent application with the SDK
• Deploy and scale the application
16. Word frequency
• Analyze files and determine top 10 most common words.
• Persist the data and write to a queue for further
processing.
• Goals: concurrent, durable, and scalable.
https://github.com/awslabs/aws-go-wordfreq-sample
24. What to expect from the session
• Get started with the AWS SDK for Go
• Build concurrent application with the SDK
• Deploy and scale the application
25. Deploy and scale
• Create the application environment
• Deploy and update Word Frequency service
• Scaling Word Frequency service environment
26. Deploying Word Frequency service
• AWS Elastic Beanstalk
• Easy to use
• Handles load balancing, scaling,
and deployments.
• No additional cost. Pay only for
the resources you use.
AWS
Elastic Beanstalk
27. What we learned in this session
Get started with the AWS SDK for Go
Build concurrent application with the SDK
Deploy and scale the application