S3

Simple Storage Service

S3 stores objects in the region selected by the user.

An S3 object consists of file and metadata. The max file size of an S3 object is 5TB. The max upload file size is 5GB. To upload more you need to use the multipart upload tool.

Naming

A bucket name needs to be unique throughout all of S3. Objects are identified via their key (path + filename).

Access

By default only the creator can access an S3 bucket. This can be changed with IAM policies.

Creating a bucket

  1. Switch to S3 service

  2. Create bucket

  3. Choose privacy

  4. Create bucket

Giving permissions to access bucket

  1. Click on bucket

  2. select permissions

  3. Bucket policy -> Edit -> Policy Generator

    1. S3 Bucket Policy

    2. Principle * (everyone)

    3. Action: GetObject

    4. ARN: arn:aws:s3:::<bucket-name>/* (the ending * makes this apply for all objects in the bucket)

    5. Add statement

    6. Generate policy

  4. Copy policy over to permissions tab in bucket settings -> Save

Upload file to bucket using CLI

  1. Navigate to folder

  2. aws s3 cp <localFolder> s3://<bucket>/<remoteFolder> --recursive --exclude "<pattern>"

CORS with S3

  1. load bucket service and click on desired bucket

  2. permissions -> scroll down to CORS -> Edit

  3. add CORS configuration, e.g. Allow All

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [
            "Authorization"
        ],
        "MaxAgeSeconds": 3000
    }
]

Last updated