Building Scalable Windows and .NET Apps
on AWS
Norm Johanson & Jim Flanagan / AWS Developer Resources
November 15, 2013

©...
What We’ll Learn
•
•
•
•

Using Amazon DynamoDB with .NET
Deploying to AWS Elastic Beanstalk
Customizing Our Beanstalk Env...
AWS Tools for the .NET Community
•
•
•
•

AWS SDK for .NET
AWS Tools for Windows PowerShell
AWS Toolkit for Visual Studio
...
AWS Tools for the .NET Community
• AWS SDK for .NET – Version 2
– Supports WinRT and Windows Phone 8

• AWS Toolkit for Vi...
Application Architecture
S3 Bucket

CloudShotz

{user123, image456}

DynamoDB Table
How DynamoDB Works
• Data is stored in Tables
• Tables do not have a fixed schema
• Tables have provisioned throughput
DynamoDB Keys
Hash Key

Range Key

Attributes

UserId

ImageId

S3Bucket

S3Key

123

456

My-images

Images/456

Key
Image: Wikimedia Commons

DynamoDB Provisioned Throughput
Throttling
Consumed Capacity

Throttled Requests

7

600

6

500

5
4
3
2

400
300
200

1

100

0

0
DynamoDB and the .NET SDK
• Low-level DynamoDB API
– 1:1 API Mapping

• Document-Based API
– Key-value Dictionary

• Objec...
Low Level API
PutItemRequest putRequest = new PutItemRequest() {
TableName = "ImageMetadata",
Item = new Dictionary<string...
Document Model API
Table table = Table.LoadTable(this.ddbClient, "ImageMetadata");
Document document = new Document();
doc...
Object Persistence Model API
ImageMetadata image = new ImageMetadata(DateTime.Now, userId);
image.Caption = "Cool Photo";
...
Amazon S3
• Unlimited Internet storage
• Keys grouped by bucket
• Objects are URL addressable
AWS Elastic Beanstalk
•
•
•
•

Easy deployment management
Creates all necessary AWS resources
You retain full control
Depl...
IAM Roles
Action

Resource

✔ s3:GetObject
✔ s3:PutObject

my-s3-bucket

✔ dynamodb:GetItem
✔ Dynamodb:PutItem

ImageMetad...
EC2 Instance Profiles

EC2

SDK looks in
multiple places
for credentials

Instance
Profile

AWS SDK

✖ Web.config
✔ Instan...
Adding an Image Processing Worker
S3 Bucket

CloudShotz

Elastic Beanstalk
Environment
DynamoDB Table
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Elastic Beanstalk
Environment
DynamoDB Table
Adding an Image Processing Worker
S3 Bucket

Worker Reads from queue
CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk...
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk
Environment
DynamoDB Ta...
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk
Environment
DynamoDB Ta...
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk
Environment
DynamoDB Ta...
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk
Environment
DynamoDB Ta...
Adding an Image Processing Worker
S3 Bucket

CloudShotz
Queue

Image Resizer Svc
Elastic Beanstalk
Environment
DynamoDB Ta...
Windows Store & Windows Phone
• New in version 2 of the SDK
• Asynchronous API only
• Service level support
– Windows Phon...
SDK Install Layout
Visual Studio Project Setup
Credential Management
• Do not embed access credentials
• Web identity federation
– Supports Facebook, Google, and Amazon
...
What’s Next?
• Try out our SDK and Tools
– AWS Website - http://aws.amazon.com/sdkfornet/
– Nuget - https://www.nuget.org/...
Please give us your feedback on this
presentation

TLS302
As a thank you, we will select prize
winners daily for completed...
Upcoming SlideShare
Loading in …5
×

Building Scalable Windows and .NET Apps on AWS (TLS302) | AWS re:Invent 2013

3,714
-1

Published on

The AWS SDK for .NET and the AWS Toolkit for Visual Studio help developers build scalable apps on AWS services. Learn how to use these tools to define app data in Amazon DynamoDB and access it through a simple object persistence framework. We demonstrate deploying a web app to a customized, auto-scaled AWS Elastic Beanstalk environment. Finally, using the new version of the AWS SDK for .NET, you learn how to access your AWS data from apps targeting the Windows Store and Windows Phone platforms.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,714
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
47
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Building Scalable Windows and .NET Apps on AWS (TLS302) | AWS re:Invent 2013

  1. 1. Building Scalable Windows and .NET Apps on AWS Norm Johanson & Jim Flanagan / AWS Developer Resources November 15, 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.
  2. 2. What We’ll Learn • • • • Using Amazon DynamoDB with .NET Deploying to AWS Elastic Beanstalk Customizing Our Beanstalk Environments Using Our SDK for Windows Store Applications
  3. 3. AWS Tools for the .NET Community • • • • AWS SDK for .NET AWS Tools for Windows PowerShell AWS Toolkit for Visual Studio AWS Elastic Beanstalk Container
  4. 4. AWS Tools for the .NET Community • AWS SDK for .NET – Version 2 – Supports WinRT and Windows Phone 8 • AWS Toolkit for Visual Studio – Supports Visual Studio 2010, 2012, and 2013 • AWS Elastic Beanstalk Container – Container customization – Instance Profiles – Single Instance Environments
  5. 5. Application Architecture S3 Bucket CloudShotz {user123, image456} DynamoDB Table
  6. 6. How DynamoDB Works • Data is stored in Tables • Tables do not have a fixed schema • Tables have provisioned throughput
  7. 7. DynamoDB Keys Hash Key Range Key Attributes UserId ImageId S3Bucket S3Key 123 456 My-images Images/456 Key
  8. 8. Image: Wikimedia Commons DynamoDB Provisioned Throughput
  9. 9. Throttling Consumed Capacity Throttled Requests 7 600 6 500 5 4 3 2 400 300 200 1 100 0 0
  10. 10. DynamoDB and the .NET SDK • Low-level DynamoDB API – 1:1 API Mapping • Document-Based API – Key-value Dictionary • Object-Persistence API – Annotated Classes
  11. 11. Low Level API PutItemRequest putRequest = new PutItemRequest() { TableName = "ImageMetadata", Item = new Dictionary<string, AttributeValue> { {"UserId", new AttributeValue {S = userId}}, {"ImageId", new AttributeValue {S = Guid.NewGuid().ToString()}}, {"Caption", new AttributeValue {S = "Cool Photo"}}, {"UploadDate", new AttributeValue { S = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")}}, {"Bucket", new AttributeValue {S = bucketName}}, {"S3Key", new AttributeValue {S = s3Key}} } }; PutItemResponse putResponse = this.ddbClient.PutItem(putRequest);
  12. 12. Document Model API Table table = Table.LoadTable(this.ddbClient, "ImageMetadata"); Document document = new Document(); document["UserId"] = userId; document["ImageId"] = Guid.NewGuid(); document["Caption"] = "Cool Photo"; document["UploadDate"] = DateTime.Now; document["Bucket"] = bucketName; document["S3Key"] = s3Key; table.PutItem(document);
  13. 13. Object Persistence Model API ImageMetadata image = new ImageMetadata(DateTime.Now, userId); image.Caption = "Cool Photo"; image.S3Bucket = bucketName; image.S3Key = s3Key; context.Save<ImageMetadata>(image);
  14. 14. Amazon S3 • Unlimited Internet storage • Keys grouped by bucket • Objects are URL addressable
  15. 15. AWS Elastic Beanstalk • • • • Easy deployment management Creates all necessary AWS resources You retain full control Deploy .NET applications from Visual Studio
  16. 16. IAM Roles Action Resource ✔ s3:GetObject ✔ s3:PutObject my-s3-bucket ✔ dynamodb:GetItem ✔ Dynamodb:PutItem ImageMetadata
  17. 17. EC2 Instance Profiles EC2 SDK looks in multiple places for credentials Instance Profile AWS SDK ✖ Web.config ✔ Instance Profile Identity and Access Management EC2 Instance
  18. 18. Adding an Image Processing Worker S3 Bucket CloudShotz Elastic Beanstalk Environment DynamoDB Table
  19. 19. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Elastic Beanstalk Environment DynamoDB Table
  20. 20. Adding an Image Processing Worker S3 Bucket Worker Reads from queue CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table
  21. 21. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table Worker gets image metadata from DynamoDB
  22. 22. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table Worker downloads full-size image from S3 bucket
  23. 23. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table Worker resizes image and puts thumbnail in S3 bucket
  24. 24. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table Worker updates image metadata In DynamoDB
  25. 25. Adding an Image Processing Worker S3 Bucket CloudShotz Queue Image Resizer Svc Elastic Beanstalk Environment DynamoDB Table Worker removes message from queue
  26. 26. Windows Store & Windows Phone • New in version 2 of the SDK • Asynchronous API only • Service level support – Windows Phone has 11 services – Window Store supports all services • Separate assemblies for each platform
  27. 27. SDK Install Layout
  28. 28. Visual Studio Project Setup
  29. 29. Credential Management • Do not embed access credentials • Web identity federation – Supports Facebook, Google, and Amazon • Token Vending Machine
  30. 30. What’s Next? • Try out our SDK and Tools – AWS Website - http://aws.amazon.com/sdkfornet/ – Nuget - https://www.nuget.org/packages/awssdk – Open Source at GitHub - https://github.com/aws/aws-sdk-net • Let us know what you think – AWS Forums – GitHub – StackOverflow • Follow our blog http://blogs.aws.amazon.com/net/ (Twitter: @awsfornet)
  31. 31. Please give us your feedback on this presentation TLS302 As a thank you, we will select prize winners daily for completed surveys!
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×