All technological notes.
Storage Class Analysis
Event Notifications
Use cases
Buckets
Bucket name:
xn---s3aliasS3 looks like a global service but buckets are created in a region
Objects
key:
the FULL path of objects:
s3://my-bucket/my_file.txts3://my-bucket/my_folder1/another_folder/my_file.txtJust keys with very long names that contain slashes (“/”)

Object value
5TB (5000GB)100 MB.Metadata
Tags
10Version ID
Durability:
Availability:




Lower cost than S3 Standard
Amazon S3 Standard-Infrequent Access (S3 Standard-IA)
Pricing: price for storage + object retrieval cost
Amazon S3 Glacier Instant Retrieval
Amazon S3 Glacier Flexible Retrieval (formerly Amazon S3 Glacier):
Moves objects automatically between Access Tiers based on usage






User-Based


Resource-Based


Bucket Access Control List (ACL)
Note: an IAM principal can access an S3 object if
ALLOW it OR the resource policy ALLOWS itDENY
Account + user level
JSON based policies








The website URL will be (depending on the region)
http://bucket-name.s3-website-aws-region.amazonaws.com ORhttp://bucket-name.s3-website.aws-region.amazonaws.com


Upload web files
Website

Same key overwrite will change the “version”: 1, 2, 3….
It is best practice to version your buckets
null


Upload files
Website after updated






S3 Replication
Cross-Region Replication (CRR)Same-Region Replication (SRR)
Must give proper IAM permissions to S3

Optionally, you can replicate existing objects using S3 Batch Replication
For DELETE operations








If origin bucket deletes a file permanently, this deletion will be replicated to the target bucket.
Xregion replication:
Lifecycle Rules
Standard IAGlacier or Glacier Deep Archive
Transition Actions
Expiration actions
prefix (example: s3://mybucket/mp3/*)Requirement:
Solution:
Standard, with a lifecycle configuration to transition them to Glacier after 60 daysOne-Zone IA, with a lifecycle configuration to expire them (delete them) after 60 daysRequirement:
Solution:
Standard IAGlacier Deep ArchiveStorage Class AnalysisStorage Class Analysis
Standard and Standard IA
One-Zone IA or Glacier








In general, bucket owners pay for all Amazon S3 storage and data transfer costs associated with their bucket
With Requester Pays buckets, the requester instead of the bucket owner pays the cost of the request and the data download from the bucket
Helpful when you want to share large datasets with other accounts
The requester must be authenticated in AWS (cannot be anonymous)

Event NotificationsEvent:
S3 event notifications typically deliver events in seconds but can sometimes take a minute or longer
Use case:

access policy

Amazon EventBridge








-









Your application can achieve at least 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests per second per prefix in a bucket.
Example (object path => prefix):
GET and HEAD
Transfer AccelerationIncrease transfer speed by transferring file to an AWS edge location which will forward the data to the S3 bucket in the target region
Compatible with multi-part upload

GETs by requesting specific byte rangesBetter resilience in case of failures


SQL by performing server-side filtering
Batch Operations
Perform bulk operations on existing S3 objects with a single request, example:
S3 GlacierA job consists of
list of objects,action to perform,parametersYou can use
S3 Inventory to get object listS3 Select to filter your objects
You can encrypt objects in S3 buckets using one of 4 methods
Server-Side Encryption (SSE)
Amazon S3-Managed Keys (SSE-S3)
AWS KMS (SSE-KMS)
AWS Key Management Service (AWS KMS) to manage encryption keysCustomer-Provided Keys (SSE-C)
Client-Side EncryptionIt’s important to understand which ones are for which situation for the exam
SSE-S3AES-256"x-amz-server-side-encryption": "AES256"
SSE-KMSAWS KMS (Key Management Service)CloudTrail"x-amz-server-side-encryption": "aws:kms"
Limitation
If you use SSE-KMS, you may be impacted by the KMS limits
GenerateDataKey KMS APIDecrypt KMS APIService Quotas Console
SSE-CHTTPS must be used
Client-Side EncryptionAmazon S3 Client-Side Encryption Library
SSL/TLSAmazon S3 exposes two endpoints:
HTTP Endpoint – non encryptedHTTPS Endpoint – encryption in flightHTTPS is recommendedHTTPS is mandatory for SSE-CMost clients would use the HTTPS endpoint by default







Note: in the console, SSE-C is not available, it can be done only with CLI.
SSE-S3 encryption is automatically applied to new objects stored in S3 bucketOptionally, you can “force encryption” using a bucket policy and refuse any API call to PUT an S3 object without encryption headers (SSE-KMS or SSE-C)


Bucket Policies are evaluated before “Default Encryption”Cross-Origin Resource Sharing (CORS)
CORS Headers (example: Access-Control-Allow-Origin)Origin = scheme (protocol) + host (domain) + port
https://www.example.com (implied port is 443 for HTTPS, 80 for HTTP)http://example.com/app1 & http://example.com/app2http://www.example.com & http://other.example.com
\* (all origins)


[
{
"AllowedHeaders": ["Authorization"],
"AllowedMethods": ["GET"],
"AllowedOrigins": [
"<url of first bucket with http://...without slash at the end>"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]


S3 MFA (Multi-Factor Authentication)
MFA will be required to:
MFA won’t be required to:
Versioning must be enabled on the bucketOnly the bucket owner (root account) can enable/disable MFA Delete

Athena.




generate temporary URLs to grant time-limited access to some actions in your S3 bucket.
Generate pre-signed URLs using the S3 Console, AWS CLI or SDK
URL Expiration
S3 Console:
12 hours)AWS CLI
--expires-in parameter in seconds168 hoursUsers given a pre-signed URL inherit the permissions of the user that generated the URL for GET / PUT
Examples:




Adopt a WORM (Write Once Read Many) model
Helpful for compliance and data retention

WORM (Write Once Read Many) modelBlock an object version deletion for a specified amount of time
Two modes:
Retention mode - Compliance:
Retention mode - Governance:
Retention Period:
s3:PutObjectLegalHold IAM permissionAccess Points simplify security management for S3 Buckets
Each Access Point has:

VPC Endpoint to access the Access Point (Gateway or Interface Endpoint)VPC Endpoint Policy must allow access to the target bucket and Access Point
AWS Lambda Functions to change the object before it is retrieved by the caller applicationOnly one S3 bucket is needed, on top of which we create S3 Access Point and S3 Object Lambda Access Points.
Use Cases:
