ESP32-C3: AWS Iot – Set the Public bucket(S3) fot OTA

Set-up

  • Create bucket
    – When creating a bucket, select Object Ownership as “ACLs_enabled“.
    – Uncheck Block all public access in the “Block Public Access settings for this bucket” menu.
    – In the Bucket Versioning menu, select “Enable“.
    – Check the warning box below it.
  • Select the created ‘bucket‘(your_bucket_name) and select the “Permissions” menu.
  • In “Bucket Policy”, set the policy as follows.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:GetObjectVersion"
            ],
            "Resource": "arn:aws:s3:::your_bucket_name/*"
        }
    ]
}

  • Press the ‘Edit’ button in the “Access control list (ACL)” menu to set ‘read/write permission‘ as follows.

  • Set “Cross-origin resource sharing (CORS)” as follows.
[
    {
        "AllowedHeaders": [
            "Authorization"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 6000
    }
]

Leave a Reply