Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

77
© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc. Trevor Rowe & Loren Segal November 13, 2013 Diving Into the New AWS SDK for Ruby Friday, November 15, 13

description

Ruby developers: attend this session and learn about the next major version of the AWS SDK for Ruby, the aws-core gem. We dive deep into the SDK, covering topics such as waiters, request enumeration and pagination, resource modeling, version locking, and more. Learn how to take advantage of these features as we construct a sample Ruby application using the AWS SDK.

Transcript of Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Page 1: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

© 2013 Amazon.com, Inc. and its affiliates. All rights reserved. May not be copied, modified, or distributed in whole or in part without the express consent of Amazon.com, Inc.

Trevor Rowe & Loren Segal

November 13, 2013

Diving Into the New AWS SDK for Ruby

Friday, November 15, 13

Page 2: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 3: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 4: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 5: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Goals

Friday, November 15, 13

Page 6: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

GoalsIntroduce Core

Friday, November 15, 13

Page 7: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

GoalsIntroduce CoreHands on Experience

Friday, November 15, 13

Page 8: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

GoalsIntroduce CoreHands on ExperienceExtending the SDK

Friday, November 15, 13

Page 9: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

GoalsIntroduce CoreHands on ExperienceExtending the SDKContributing

Friday, November 15, 13

Page 10: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

gem install aws-sdk

Friday, November 15, 13

Page 11: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 12: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

2.0Friday, November 15, 13

Page 13: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

Friday, November 15, 13

Page 14: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

Validation

Friday, November 15, 13

Page 15: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

ValidationStructured Responses

Friday, November 15, 13

Page 16: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

ValidationStructured ResponsesBetter Documentation

Friday, November 15, 13

Page 17: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

ValidationStructured ResponsesBetter DocumentationExtensibility

Friday, November 15, 13

Page 18: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Why Version 2.0?

ValidationStructured ResponsesBetter DocumentationExtensibilityConsistency

Friday, November 15, 13

Page 19: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

gem install aws-sdk-core

Friday, November 15, 13

Page 20: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 21: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

aws-sdk

Version 1

Friday, November 15, 13

Page 22: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

aws-sdk

Version 1 Version 2

aws-sdk-core

Friday, November 15, 13

Page 23: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

aws-sdk

Version 1 Version 2

aws-sdk-core

work-in-progress

Friday, November 15, 13

Page 24: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

CodeFriday, November 15, 13

Page 25: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

Friday, November 15, 13

Page 26: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

New Namespace

Friday, November 15, 13

Page 27: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

New NamespaceMemoization Everywhere

Friday, November 15, 13

Page 28: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

New NamespaceMemoization EverywhereRuby 1.9+

Friday, November 15, 13

Page 29: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

New NamespaceMemoization EverywhereRuby 1.9+Flexible Dependencies

Friday, November 15, 13

Page 30: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Key Differences

New NamespaceMemoization EverywhereRuby 1.9+Flexible DependenciesStructured Responses

Friday, November 15, 13

Page 31: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

Friday, November 15, 13

Page 32: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

Resources

Friday, November 15, 13

Page 33: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

ResourcesEnumeration

Friday, November 15, 13

Page 34: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

ResourcesEnumerationPagination

Friday, November 15, 13

Page 35: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

ResourcesEnumerationPaginationHelpers

Friday, November 15, 13

Page 36: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

What’s Coming?

ResourcesEnumerationPaginationHelpersService Gems

Friday, November 15, 13

Page 37: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Developer Preview

Friday, November 15, 13

Page 38: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Developer PreviewPublic

Friday, November 15, 13

Page 39: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Developer PreviewPublicFeedback

Friday, November 15, 13

Page 40: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Developer PreviewPublicFeedbackStability

Friday, November 15, 13

Page 41: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

ExtendingThe SDK

Friday, November 15, 13

Page 42: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Friday, November 15, 13

Page 43: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Friday, November 15, 13

Page 44: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Friday, November 15, 13

Page 45: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Friday, November 15, 13

Page 46: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Serialize

Friday, November 15, 13

Page 47: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Serialize

Send

Friday, November 15, 13

Page 48: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Serialize

Send

Parse

Friday, November 15, 13

Page 49: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Serialize

Send

Parse

Middleware

Friday, November 15, 13

Page 50: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Request Response

Validate

Serialize

Send

Parse

Middleware

Application

Friday, November 15, 13

Page 51: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing Plugins* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 52: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing PluginsIdeas:

* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 53: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing PluginsIdeas:

Data Integrity Checks

* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 54: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing PluginsIdeas:

Data Integrity ChecksExtended Retry Logic

* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 55: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing PluginsIdeas:

Data Integrity ChecksExtended Retry LogicDefault Values

* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 56: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Writing PluginsIdeas:

Data Integrity ChecksExtended Retry LogicDefault ValuesCross Service Hooks

* The entire SDK is written as a series of plugins

Friday, November 15, 13

Page 57: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugins, Handlers and Context, Oh My!

Friday, November 15, 13

Page 58: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugins, Handlers and Context, Oh My!

Plugin

Configuration

Handlers

Friday, November 15, 13

Page 59: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugins, Handlers and Context, Oh My!

Plugin

Configuration

Handlers

Configuration

Options

Defaults

Friday, November 15, 13

Page 60: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugins, Handlers and Context, Oh My!

Plugin

Configuration

Handlers

Configuration

Options

Defaults

Handlers

#call method

Build request

Parse response

Friday, November 15, 13

Page 61: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugin• provides a DSL• easy to add/remove

Handler• stacked• similar to rack middleware

Context• operation name• configuration• request parameters• http request• http response• response data• response error

Plugins, Handlers and Context, Oh My!

Friday, November 15, 13

Page 62: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Plugin• provides a DSL• easy to add/remove

Handler• stacked• similar to rack middleware

Context• operation name• configuration• request parameters• http request• http response• response data• response error

Plugins, Handlers and Context, Oh My!

Let’s Build Something!

Friday, November 15, 13

Page 63: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Best Practices• Depend on major versions of the SDK

• gem  “aws-­‐sdk-­‐core”,  “~>  2.0”

• API Locking• Lock your clients to a specific API version• Aws::DynamoDB.new(api_version:  ‘2012-­‐08-­‐10’)

• Secure Credential Management• Rotate credentials

• Use IAM roles for EC2 instances when possible• ENV variables (Heroku, etc.)• From a file on disk (outside source control)• Never check your credentials into source control!

Friday, November 15, 13

Page 64: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Contributing

Friday, November 15, 13

Page 65: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

Friday, November 15, 13

Page 66: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issues

Friday, November 15, 13

Page 67: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issuesPull Requests

Friday, November 15, 13

Page 68: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issuesPull RequestsTest Coverage

Friday, November 15, 13

Page 69: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issuesPull RequestsTest CoverageDocs/Guides

Friday, November 15, 13

Page 70: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issuesPull RequestsTest CoverageDocs/GuidesSamples

Friday, November 15, 13

Page 71: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Open Source

GitHub issuesPull RequestsTest CoverageDocs/GuidesSamples3rd Party Gems

Friday, November 15, 13

Page 72: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Links of Interest

Friday, November 15, 13

Page 73: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

https://github.com/aws/aws-sdk-core-ruby

Links of Interest

Friday, November 15, 13

Page 74: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

http://ruby.awsblog.com/

https://github.com/aws/aws-sdk-core-ruby

Links of Interest

Friday, November 15, 13

Page 75: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

http://ruby.awsblog.com/

https://github.com/aws/aws-sdk-core-ruby

https://forums.aws.amazon.com/forum.jspa?forumID=125

Links of Interest

Friday, November 15, 13

Page 77: Diving Into the New AWS SDK for Ruby (TLS305) | AWS re:Invent 2013

Please give us your feedback on this presentation

As a thank you, we will select prize winners daily for completed surveys!

TLS305 Thank You

Friday, November 15, 13