S3
-
Simple Storage Service
AWS service for storing “objects”
-
S3 stores Objects in the Region you specify
-
An S3 Object is made up of two parts:
- File
- Metadata
-
Any file type can be stored in S3
-
The maximum object size in S3 is 5 terabytes
-
Objects are collected in a structure called a “Bucket”
-
Bucket names need to be unique across all of S3
-
Objects are refered to by a “key”
-
S3 Object Key Example
Filename = image.png
Folder Name = images
Object Key = images/image.png
-
S3 Access with Permissions
By default, buckets and objects in a bucket are only accessable by the account that created them.
There are permissions setting that will allow for the changing of access to buckets and objects
-
S3 Access with IAM Roles
We can use IAM roles to specify access to buckets and object
-
Uploading to S3
- Web Console : Adhoc or Small Number of File Uploading
- CLI : Recursive Directory Uploading
- SDK : Dynamic in Code Uploading
-
Web Console
Create bucket and upload object
use policy creator to set bucket policy
replace this with some screenshots of get this done
-
CLI
aws s3 cp <local_folder> s3://<bucket>/<remote_folder> --recursive --exclude "<pattern>"
upload some file and view through console
-
SDK (Python)
The BOTO3 python library gives access to AWS services. This is how to access S3 and other services.
-
Client
A low-level client representing Amazon Simple Storage Service (S3):
import boto3
client = boto3.client('s3')
client.put_object(Bucket = self.bucket_name,
Body = file_bytes,
Key = file_name,
ACL = 'public-read')