MBL302 Using the AWS Mobile SDKs - AWS re: Invent 2012

1,049 views
911 views

Published on

The AWS Mobile SDKs can be used to build thick-client architecture apps for iOS and Android devices. An overview of the SDKs will be presented as well as demos and code for storing data in Amazon S3 and sending emails via Amazon SES. You will also learn how to manage AWS credentials in a mobile environment.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,049
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

MBL302 Using the AWS Mobile SDKs - AWS re: Invent 2012

  1. 1. Agenda• Overview of the AWS Mobile SDKs: • http://aws.amazon.com/mobile • AWS SDK for iOS : http://aws.amazon.com/sdkforios/ • AWS SDK for Android : http://aws.amazon.com/sdkforandroid/• Common use cases • Data storage • Searchable data • Application feedback • Messaging• Managing credentials
  2. 2. AWS Mobile SDKs• What are the AWS mobile SDKs?• Who should use them?• Which services do they support?• How are they integrated into my applications?• How do I get help or support using the mobile SDKs?• Where is the source code for the SDKs?
  3. 3. What Are the AWS Mobile SDKs?• Simplifies mobile-to-cloud development• Thick-client architecture• AWS SDK for iOS • Support iOS v4.3 and above• AWS SDK for Android • Supports Android v2.2 (API Level 8) and above
  4. 4. Who Should Use Them?• Thick-client applications• Don’t want to manage a back end• Want users to make direct calls to the cloud• Back-end processing isn’t necessary
  5. 5. Thin Versus Thick-Client Architecture AWS SDKs custom thin architecture APIs AWS mobile SDKs Thick clientsThin clients proxy thick architecture connect directly torequests through the services theyintermediary services need
  6. 6. Which Services Do They Support?• The AWS mobile SDKs support 11 services: • Amazon Simple Storage Service (S3) • Amazon DynamoDB • Amazon Simple Queue Service (SQS) • Amazon Simple Notification Service (SNS) • Amazon Simple Email Service (SES) • Amazon Elastic Compute Cloud (EC2) • Elastic Load Balancing • Auto Scaling • Amazon CloudWatch • Amazon SimpleDB • AWS Security Token Service (STS)
  7. 7. Integration• How are the SDKs integrated into my application? • AWS SDK for iOS • Single framework that can be added to your application • AWS SDK for Android • Single or service level jars available
  8. 8. Minimization• How BIG will the SDKs make my application? • AWS SDK for iOS • Statically linked –only the parts you use will be added to your application • AWS SDK for Android • Proguard integration to help obfuscate and minimize the size of your application
  9. 9. Amazon S3• SDK has many samples with Amazon S3 • Amazon S3 allows for the storage and retrieval of data• Article and sample for Amazon S3: • http://aws.amazon.com/articles/SDKs/3002109349624271
  10. 10. Amazon S3 Demo
  11. 11. Amazon S3 SDK CodeiOS Android// Create Amazon S3 Client // Create Amazon S3 ClientAmazonS3Client *s3 = [[AmazonS3Client alloc] AmazonS3Client s3 = new AmazonS3Client( initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY]; new BasicAWSCredentials( ACCESS_KEY_ID, SECRET_KEY ) );// Create an S3 Bucket // Create an S3 Bucket[s3 createBucketWithName:PICTURE_BUCKET]; s3.createBucket(PICTURE_BUCKET);// Put an Object into a Bucket // Put an Object into a BucketS3PutObjectRequest *por = [[S3PutObjectRequest alloc] PutObjectRequest por = initWithKey:PICTURE_NAME inBucket:PICTURE_BUCKET]; new PutObjectRequest(PICTURE_BUCKET,por.contentType = @"image/jpeg"; PICTURE_NAME,por.data = image; new java.io.File( image ) );[s3 putObject:por]; s3.putObject( por );// Get an Object from a Bucket // Get an Object from a BucketS3GetObjectRequest *gor = [[S3GetObjectRequest alloc] S3Object data = s3.getObject(PICTURE_BUCKET, PICTURE_NAME); initWithKey:PICTURE_NAME withBucket:PICTURE_BUCKET];S3GetObjectResponse *response = [s3 getObject:gor];
  12. 12. Queuing / Messaging (Amazon SQS, Amazon SNS)• Queue up data for the application/user• Send SMS/email to many users at once• Article and sample for Amazon SNS & Amazon SQS: • http://aws.amazon.com/articles/SDKs/9156883257507082
  13. 13. Application Feedback (Amazon SES Demo)• Have the application send you customer feedback, stack traces, etc. • Don’t leave the app to go to the mail client • Customers don’t worry about exposing their email address• Article and sample included with SDKs for Amazon SES: • http://aws.amazon.com/articles/SDKs/3290993028247679
  14. 14. Amazon SES DEMO
  15. 15. Amazon SES Demo CodeiOS Android// Create Amazon SES Client // Create Amazon SES ClientAmazonSESClient *ses = [[AmazonSESClient alloc] AmazonSESClient ses = new AmazonSESClient( initWithAccessKey:ACCESS_KEY_ID withSecretKey:SECRET_KEY]; new BasicAWSCredentials( ACCESS_KEY_ID, SECRET_KEY ) );// Create the Message // Create the MessageSESMessage *message = [Utility createMessage]; Message message = Utility.createMessage();// Send the Message // Send the MessageSESDestination *destination = [[SESDestination alloc] init]; Destination to = new[destination.toAddresses addObject:@”email@domain.com”]; Destination().withToAddresses( “email@domain.com” ); String from = “email@domain.com”; SendEmailRequest ser= new SendEmailRequest( from, to, message );SESSendEmailRequest *ser = [[SESSendEmailRequest alloc] init]; SendEmailResult result = ses.sendEmail( ser);ser.source = @”email@domain.com”;ser.destination = destination;ser.message = message;SESSendEmailResponse response = [ses sendEmail:ser];
  16. 16. Storing Searchable Data (Amazon DynamoDB)• NoSQL database• SDKs have low and high level interfaces: • AWS Persistence Framework for Core Data • DynamoDB Mapper for Android• Articles and samples for all interfaces included in SDKs: • http://aws.amazon.com/articles/SDKs/7439603059327617 • http://aws.amazon.com/articles/SDKs/4435846131581972 • http://aws.amazon.com/articles/SDKs/3756417425850538
  17. 17. Managing Credentials• DO NOT embed your ROOT credentials • If compromised, your entire AWS account is accessible
  18. 18. Managing Credentials• Create an IAM account with limited permissions? { "Statement : [{ "Effect":"Allow", "Action":["s3:PutObject","s3:GetObject"], "Resource":"arn:aws:s3:::my_bucket/*"}] }• DO NOT embed IAM account credentials • Can’t rotate the credentials • NO individual user controls or revocation
  19. 19. Token Vending Machine TVM STS Simple DB temporary get token credentials requests via AWS mobile SDK using temporary credentials
  20. 20. Token Vending Machine• DO NOT EMBED YOUR CREDENTIALS! • http://aws.amazon.com/articles/SDKs/4611615499399490• Full Application TVM sample • http://aws.amazon.com/code/4598681430241367
  21. 21. Token Vending Machine Demo• Amazon S3 personal file store demo using the token vending machine
  22. 22. Temporary Credentials—It’s in the Policy{ "Statement : [{ "Effect":"Allow", "Action":["s3:PutObject","s3:GetObject","s3:DeleteObject"], "Resource":"arn:aws:s3:::reinvent-personal-file-store/__USERNAME__/*"},{ "Effect":"Allow", "Action":"s3:ListBucket", "Resource":"arn:aws:s3:::reinvent-personal-file-store", "Condition":{"StringLike":{"s3:prefix":"__USERNAME__/"}}}]}
  23. 23. Resources• Links to services supported by AWS mobile SDKs: • Amazon S3 (http://aws.amazon.com/s3/) • Amazon DynamoDB (http://aws.amazon.com/dynamodb/) • Amazon SQS (http://aws.amazon.com/sqs/) • Amazon SNS (http://aws.amazon.com/sns/) • Amazon SES (http://aws.amazon.com/ses/) • Amazon EC2 (http://aws.amazon.com/ec2/) • Elastic Load Balancing (http://aws.amazon.com/elasticloadbalancing/) • Auto Scaling (http://aws.amazon.com/autoscaling/) • CloudWatch (http://aws.amazon.com/cloudwatch/) • Amazon SimpleDB (http://aws.amazon.com/simpledb/)
  24. 24. How Do I Get Help/Support Using the Mobile SDKs?• Community support available through the AWS forums • https://forums.aws.amazon.com/forum.jspa?forumID=88• SDKs contain a number of samples and articles• AWS mobile blogs • Release updates • Tips & Tricks
  25. 25. Where’s the Source?• All SDK source is available on GitHub: • http://github.com/aws/aws-sdk-android • http://github.com/aws/aws-sdk-ios• Source includes project files to enable you to build the source directly• Want something changed/improved? • Fork and submit a pull request!
  26. 26. We are sincerely eager to #reinvent hear your feedback on thispresentation and on re:Invent. Please fill out an evaluation form when you have a chance.

×