Create an S3 Bucket with AWS
March 2016 · 3 minute read
1. Log into console
2. Select s3 - Under Storage, content and Delivery
3. Create a Bucket
4. Bucket Name is a unique namespace globally (regardless of region) and must be lowercase characters only.
* Under permissions you can set permissions and ass bucket policies.
* Can enable static website hosting which turns your bucket into a static website and is infinitely scalable.
* Can enable logging to log all actions on the bucket. Can be logged either to the bucket itself or to another bucket (probably better in terms of security)
* Can trigger events such as an SNS or SQS event or a Lambda function i.e. if someone uploads a file to this bucket.
* Can allow versioning
* Can allow lifecycle rules
* Cross-region replication allows anything uploaded to a bucket to be automatically cross-replicated to another bucket in another region (Versioning must be enabled)
* Tags can be added to buckets which can very helpful when it comes to billing.
* Requester pays means that every time someone else with an AWS account tries to do a request/data transfer from the bucket that person pays. If this function is turned on, it means you cannot have anonymous access to your bucket.
5. To upload new files: Open test bucket => upload => select a file
6. Files uploaded are automatically private but can be made public. All files can be stored in different storage classes within the same bucket.
s3 Versioning
1. Select bucket => properties => Versioning.
2. Once enabled, versioning cannot be disabled. It can only be suspended. The only way to remove it is to delete the bucket and create a new one.
* If you accidentally delete a file, you can restore it by deleting the “delete marker”
* Every version stored in a bucket takes up space, including old and deleted versions.
3. Cross-region Replication is a great way to maintain backups. MUST have versioning enabled on BOTH source and destination buckets.
a) Cross-region replication replicated every FUTURE upload of every object to another bucket. Existing objects will NOT be replicated.
s3 Life Cycle Management
1. Apply a rule to the whole bucket to help manage storage costs.
2. Allows you to automatically move files around i.e. move an object to infrequently accessed bucket 30 days after upload (must wait a minimum of 30 days before it can be moved), move to glacier archival 30 days after that (must wait a minimum of another 30 days before it can be moved) and permanently delete 3 years after that. (Cannot be deleted on the same day as it is moved, must wait a minimum of 1 day after it has been moved).
3. Once versioning is enabled, you have the option to apply different actions to the both the current and previous versions. i.e. you might want to expire the current version 30 days after it is uploaded and permanently delete the previous version 30 days after it becomes the previous version.