Aws 03 S3
Aws 03 S3
Amazon S3
Durable Available
Amazon S3
Easy to Use Secure
Amazon S3
KEYS
AMAZON S3 FUNDAMENTALS
Fast Economical
Delete an object
AMAZON S3 FUNDAMENTALS
Fast Economical
Write once,
Read many
Eventually consistent
A web store, not a file system
Write once,
Read many
Eventually consistent
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Region
A web store, not a file system
Write once,
Read many
Eventually consistent
New Objects
Synchronously stores your data across multiple
facilities before returning SUCCESS
A web store, not a file system
Read-after-write consistency,
except US-STANDARD region
Updates
Write then read: could report key does not exist
Write once, Write then list: might not include key in list
Read many Overwrite then read: old data could be returned
Deletes
Delete then read: could still get old data
Eventually consistent Delete then list: deleted key could be included in
list
assets/js/jquery/plugins/jtables.js
SECURE BY DEFAULT
Allow
Actions
PutObject
Resource
arn:aws:s3:::mybucket/*
Bob Jane
Find out more here: aws.amazon.com/iam
IAM Policies
Fine grained
Administer as part of role
based access
Apply policies to S3 at
role, user & group level
Allow
Actions
PutObject
Resource
arn:aws:s3:::mybucket/*
Bob Jane
Find out more here: aws.amazon.com/iam
IAM Policies
Fine grained
Administer as part of role
based access
Apply policies to S3 at
role, user & group level
Allow
Actions
PutObject
Resource
arn:aws:s3:::mybucket/*
Bob Jane
Find out more here: aws.amazon.com/iam
IAM Policies Bucket Policies
Fine grained Fine grained
Administer as part of role Apply policies at the bucket
based access level in S3
Apply policies to S3 at Incorporate user restrictions
role, user & group level without using IAM
Allow Allow
Bob, Jane
Actions Actions
PutObject PutObject
Resource Resource
arn:aws:s3:::mybucket/* arn:aws:s3:::mybucket/*
mybucket
Granting Read-Only Permission to an Anonymous User
{
"Version":"2012-‐10-‐17",
" Sta te m ent " : [
{
“Sid":"AddPerm",
"Effect":"Allow", The effect of the policy, allow or deny
"Principal": " * " , Who the policy applies to. * means everyone
"Action":["s3:GetObject"] , The actions allowed/denied by this policy
"Resource":["arn:aws:s3:::examplebucket/*"]
}
The AWS resource that this policy applies to.
]
In this case all objects in example bucket
}
Bucket Policies Restricting Access to Specific IP Addresses
Fine grained
Apply policies at the bucket
level in S3 {
" V e r s i o n " : "2012-‐10-‐17",
Incorporate user restrictions " I d " : " S 3 P o licyId 1",
"Statement": [
without using IAM {
" Si d " : "IPAllow",
" E f f e c t " : "Allow",
"Principal": " * " ,
"Action": " s 3 : * " ,
"Resource": "arn:aws:s3:::examplebucket/*",
Allow "Condition": {
Bob, Jane "IpAddress": {"aws:SourceIp": "54.240.143.0/24"},
"NotIpAddress": {"aws:SourceIp": "54.240.143.188/32"}
Actions }
PutObject }
]
Resource }
arn:aws:s3:::mybucket/*
mybucket
Bucket Policies
Fine grained Other Example Use-Cases for Bucket Policies
Apply policies at the bucket • Granting Permissions to Multiple Accounts with
level in S3 Added Conditions
Incorporate user restrictions • Restricting Access to a Specific HTTP Referrer
without using IAM • Granting Permission to an Amazon CloudFront
Origin Identity
• Adding a Policy to Require MFA Authentication
Allow
• Granting Cross-Account Permissions to Upload
Bob, Jane
Objects While Ensuring the Bucket Owner Has Full
Actions
Control
PutObject
Resource
arn:aws:s3:::mybucket/*
mybucket
Find out more here: docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
IAM Policies Bucket Policies ACLs
Fine grained Fine grained Coarse grained
Administer as part of role Apply policies at the bucket Apply access control rules
based access level in S3 at the bucket and/or object
Apply policies to S3 at Incorporate user restrictions level in S3
role, user & group level without using IAM
mybucket myobject
DEMO: GETTING STARTED
STORAGE CLASSES
Standard Designed to provide 99.999999999% durability and 99.99%
availability of objects over a given year
Designed to sustain the concurrent loss of data in two facilities
Glacier Suitable for archiving data, where data access is infrequent and a
retrieval time of several hours is acceptable
Uses the very low-cost Amazon Glacier storage service, but
managed through Amazon S3
AWS CLI
>>> mybucket.copy_key('aws_uki.txt','aws-‐ianm-‐s3-‐
masterclass','aws_uki.txt',storage_class='REDUCED_REDUNDANCY')
What about Amazon Glacier?
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3EncryptionClient.html
SECURING DATA AT REST
Amazon S3 Server Side Encryption (SSE)
Per-object key
Master key
SSE with Customer-Provided Keys (SSE-C)
AWS KMS provides an audit trail so you can see who used
your key to access which object and when
ADDITIONAL SECURITY FEATURES
AUDIT LOGS
MULTI-FACTOR
AUTHENTICATION DELETE
TIME-LIMTED ACCESS
TO OBJECTS
Signed URLs Access Permissions
Provide time-limited access to Use on objects in non-public
specific objects that expires after a buckets to prevent access once
set period the signed URL has expired
https://ianmas-‐aws.testbucket.s3.amazonaws.com/testfile.txt
?Signature=JHCa39GV1fKRKkEnAWzI88lH7f8%3D
&Expires=1391425438
&AWSAccessKeyId=AKIAIRBKBJ3ZAYAXFC2Q
Generating time-limited signed links Python
VERSIONING
AWS Console
AWS Console
AWS CLI
http://docs.aws.amazon.com/cli/latest/reference/s3api/index.html#cli-aws-s3api
AWS CLI
None None
VERSIONS "36bc67941830bb388c9bf201440683a4" True s3-‐masterclass-‐logo.txt 2015-‐05-‐18T15:47:38.000Z
337 STANDARD q2FcbXFAgU7P82Hh6y81hYkrbGYtOCCc
OWNERianm 4ee381d180ee58aa815e7d4a3a5f739b20bb8980a568947384e59c8d0ff8379b
VERSIONS "e0253c9354f61097cbf6ce239afd0464" False s3-‐masterclass-‐logo.txt 2015-‐05-‐18T15:47:30.000Z
337 STANDARD p_4oF4eG7Be.0aNXqUYFlZL7Q9OuK9nU
OWNERianm 4ee381d180ee58aa815e7d4a3a5f739b20bb8980a568947384e59c8d0ff8379b
VERSIONS "84defb05031845e8b0616a9b70b2ae93" False s3-‐masterclass-‐logo.txt 2015-‐05-‐18T15:47:10.000Z
328 STANDARD BykgMQ6bRY02Y6krxvMaMvwrL2Ep2e6X
OWNER ianm 4ee381d180ee58aa815e7d4a3a5f739b20bb8980a568947384e59c8d0ff8379b
AWS CLI
$ more v e r s i o n . t x t
_ _
/ | / | \/ | _ | |_ _ | | _
\ \ |_ \ | | \ / | | / _` / | / _ \ ' / | | / _` / / |
) | ) | | | | | (_| \ \ || / | | ( | | (_| \ \ \
| / / | _| | _| \ , _| /\ \ | _| \ | _| \ , _| / /
Version 3
http://docs.aws.amazon.com/cli/latest/reference/s3api/index.html#cli-aws-s3api
Listing object versions Python
LIFECYCLE RULES
Object Archiving
Move objects from S3 to Glacier
Amazon Glacier
Durable
Designed for 99.999999999%
durability of archives
Amazon Glacier
Cost Effective
Write-once, read-never. Cost effective for long
term storage. Pay for accessing data
Expir
Logs logs
accessible from S3
y
time
accessible from S3
Expir
✗
Logs logs
y
Objects expire
and are deleted
time
Object transition to
Glacier invoked
Transitio
Txns
accessible from S3
n
accessible from S3
Expir
✗
Logs logs
y
Objects expire
and are deleted
time
Object transition to Restoration of object
Glacier invoked requested for x hrs
Transitio
Txns
accessible from S3
n
accessible from S3
Expir
✗
Logs logs
y
Objects expire
and are deleted
time
Object transition to Restoration of object Object held in S3
Glacier invoked requested for x hrs RRS for x hrs
Transitio
Txns
accessible from S3 3-5hrs
n
accessible from S3
Expir
✗
Logs logs
y
Objects expire
and are deleted
time
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules AWS Console
Configuring Lifecycle Rules .Net
With Amazon S3, you can reliably serve your traffic and
handle unexpected peaks without worrying about scaling
your infrastructure
docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
Static Website Hosting Bucket Properties
Setting Default Documents
Redirecting Requests
Bucket Policy
{
"Version":"2008-‐10-‐17",
"Statement":[{
"Sid":"PublicReadGetObject",
"Effect":"Allow",
"Principal": {
"AWS": " * "
},
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::example-‐bucket/*"
]
}
]
}
Website Addressing
{bucket-‐name}.s3-‐website-‐{region}.amazonaws.com
e . g . mybucket.s3-‐website-‐eu-‐west-‐1.amazonaws.com
Normal Addressing
s3-‐{region}.amazonaws.com/{bucket-‐name}/{object-‐key}
e . g . s3-‐eu-‐west-‐1.amazonaws.com/mybucket/img.png
{bucket-‐name}.s3-‐{region}.amazonaws.com/{object-‐key}
e . g . mybucket.s3-‐eu-‐west-‐1.amazonaws.com/img.png
DNS Record set for:
aws-‐exampl.es
Route
53
DNS Record set for:
aws-‐exampl.es
Route
53
Index Error
bucket bucket .html .html
aws-‐exampl.es
Route
53
aws-‐exampl.es
aws-‐exampl.es
CNAME for www. to:
Route A Record ‘Alias’ to S3 website:
www.aws-‐exampl.es.s3-‐website-‐ eu- 53 aws-‐exampl.es @
‐west-‐1.amazonaws.com s3website-‐eu-‐west1-‐amazonaws.com
2 S3 can be used alone with other AWS services or 3rd party tools & services
http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
AWS Lambda
aws.amazon.com/lambda