Contenu connexe
Similaire à Amazon shafaq v6-10-12-11
Similaire à Amazon shafaq v6-10-12-11 (20)
Amazon shafaq v6-10-12-11
- 1. Amazon SDK on Android Devices
CTIA ENTERPRISE AND APPLICATIONS 2011
Shafaq Abdullah
Principal/Architect, Software
October 12, 2011
Twitter: @shafaq110
Shafaq.abdullah@zenprise.com
© 2011 Zenprise, Inc. All rights reserved. 0
- 2. Amazon Web Services
• Storage
• Database
• Messaging
• Compute
• Monitoring
© 2011 Zenprise, Inc. All rights reserved. 1
- 3. Amazon Web Services
• Amazon S3
• Amazon Simple Db
• Amazon SQS
• Amazon SNS
© 2011 Zenprise, Inc. All rights reserved. 2
- 5. CRUD
Operation Description Http Method
Read Just read, without modifying GET
Delete Delete resource DELETE
Create Create a new resource PUT /POST
Update Modify resource's value POST/PUT
© 2011 Zenprise, Inc. All rights reserved. 4
- 6. AWS Demo
© 2011 Zenprise, Inc. All rights reserved. 5
- 7. AWS Demo
© 2011 Zenprise, Inc. All rights reserved. 6
- 8. S3 Storage Schema
• Similar to files and folders
• No bucket(s) inside bucket
© 2011 Zenprise, Inc. All rights reserved. 7
- 9. Amazon S3 Bucket
Amazon S3
Your S3 Bucket
Object 1
Object 2 Object 3
© 2011 Zenprise, Inc. All rights reserved. 8
- 10. Creating a Bucket in S3
AWSAuthConnection conn = new AWSAuthConnection
(accessKeyId, secretAccessKey, false, Utils.DEFAULT_HOST,
Utils.INSECURE_PORT, CallingFormat.getPathCallingFormat());
Response createResponse = conn.createBucket(“TestBucket”, null, null); //PUT
© 2011 Zenprise, Inc. All rights reserved. 9
- 12. Amazon S3 is Restful
• Stateless
• Client-Server
• Layered Architecture
• Uniform Interface
• Cacheable
• Coding on Demand (optional)
© 2011 Zenprise, Inc. All rights reserved. 11
- 13. Security Principles
• Build Security in every layer
• Group based rule for controlling access in every layer
• Limit access to specific IP ranges
• Encrypt stored data
• Encrypt data in-transit
• Rotate AWS credentials, Multifactor authentication
© 2011 Zenprise, Inc. All rights reserved. 12
- 14. Amazon Account Setup
• Access Credentials: Your Access Keys, X.509 Certificates,
and Key Pairs
• Sign-In Credentials: Your E-mail Address, Password, and
AWS Multi-Factor Authentication Device
• Account Identifiers: Your AWS Account ID and Canonical
User ID
© 2011 Zenprise, Inc. All rights reserved. 13
- 15. AWS Account Identifiers
• AWS uses two types of account identifiers
• The canonical user ID can be used exclusively for Amazon S3
resources such as buckets or files
• The AWS account ID can be used for all AWS service
resources except Amazon S3
© 2011 Zenprise, Inc. All rights reserved. 14
- 16. Amazon S3 Client
• Public List<Bucket> listBuckets
• Public Bucket createBucket(String bucketName)
• Public ObjectMetadata getObjectMetadata(String
bucketName, String key)
• Public S3Object getObject(String bucketName, String key)
• Public PutObjectResult putObject(String bucketName, String
key, File file)
© 2011 Zenprise, Inc. All rights reserved. 15
- 17. Amazon Simple DB Description
• Hierarchy for DataStorage in SImpleDB
- Domains
- Items
- Attributes
© 2011 Zenprise, Inc. All rights reserved. 16
- 19. Data Creation in SimpleDB
• Region Selection
US East (Northern Virginia), US West (Northern California),
EU (Ireland)
Asia Pacific (Singapore), Asia Pacific (Tokyo) Regions
• AmazonSimpleDBAsyncClient: has followoing methods for
Data Creation
CreateDomain
DeleteDomain
ListDomains
DomainMetadata
© 2011 Zenprise, Inc. All rights reserved. 18
- 20. Retrieving Data in Simple DB
• GetAttributes to retrieve a specific item
• Select to query your data set for items that meet specified
criteria
© 2011 Zenprise, Inc. All rights reserved. 19
- 21. API Highlight of Amazon Simple DB
• CreateDomain — Create a domain that contains your dataset.
• DeleteDomain — Delete a domain.
• ListDomains — List all domains.
• DomainMetadata — Retrieve information about creation time for the domain, storage
information both as counts of item names and attributes, as well as total size in bytes.
• PutAttributes — Add or update an item and its attributes, or add attribute-value pairs to
items that exist already. Items are automatically indexed as they are received.
• BatchPutAttributes — For greater overall throughput of bulk writes, perform up to 25
PutAttribute operations in a single call.
• DeleteAttributes — Delete an item, an attribute, or an attribute value.
• BatchDeleteAttributes — For greater overall throughput of bulk deletes, perform up to 25
DeleteAttributes operations in a single call.
• GetAttributes — Retrieve an item and all or a subset of its attributes and values.
• Select — Query the data set in the familiar Example: select * from mydomain where
every(keyword) = ‘Car’. Order results using the SORT operator, and count items that meet
the condition(s) specified by the predicate(s) in a query using the Count operator.
© 2011 Zenprise, Inc. All rights reserved. 20
- 22. SimpleDB Use Case
S3ObjectID Date Last Subject Comments Rating Tags
Created Modified
0001 10-10-2011 10-10-2011 • Science • Good A • Information
• Animal • Fair • Nature
History
© 2011 Zenprise, Inc. All rights reserved. 21
- 23. Simple DB: Read Operation
Eventually Consistent Read Consistent Read
Stale reads possible No stale reads
Lowest read latency Higher read latency
Highest read throughput Lower read throughput
http://www.allthingsdistributed.com/2010/02/strong_consistency_simpledb.html
© 2011 Zenprise, Inc. All rights reserved. 22
- 24. Amazon SQS
• Used to pass messages asynchronously between two
distributed applications
© 2011 Zenprise, Inc. All rights reserved. 23
- 26. Amazon SQS
• A single queue can be shared with multiple server
• A server can “lock” the message under process with a
timeout, if its not able to delelte it within the timeout then the
lock is relinquished
© 2011 Zenprise, Inc. All rights reserved. 25
- 27. Basic SQS API
• CreateQueue: Create queues for use with your AWS account
• ListQueues: List your existing queues
• DeleteQueue: Delete one of your queues
• SendMessage: Add any data entries to a specified queue
• ReceiveMessage: Return one or more messages from a
specified queue
© 2011 Zenprise, Inc. All rights reserved. 26
- 28. Life Cycle of SQS API
• System uses SendMessage to add a new message to it SQS
• A different system that processes messages needs more
messages to process, so it calls ReceiveMessage
• Once a message has been returned by ReceiveMessage, it will
not be returned by any other ReceiveMessage until the
visibility timeout has passed
• If the system that processes messages successfully finishes
working with this message, it calls DeleteMessage, which
removes the message from the queue so no one else will ever
process it
© 2011 Zenprise, Inc. All rights reserved. 27
- 29. Amazon SNS
• A highly scalable, flexible, and cost-effective capability to
publish messages from an application and immediately
deliver them to subscribers or other application
• SNS push and SQS poll mechanism
© 2011 Zenprise, Inc. All rights reserved. 28
- 30. NetFlix and AWS
http://qcontokyo.com/pdf/adriancockroft.pdf
© 2011 Zenprise, Inc. All rights reserved. 29