# Create S3 static web

* Create a bucket `myforms3`

* Create a static web artifacts

  * Flutter : `flutter build web`
    * Upload `build/web` artifacts to S3 bucket

* S3

  * Goto bucket properties

  * Enable `Static website hosting` feature

    * Endpoint will be shown in this section
    * http://myforms3.s3-website-ap-southeast-1.amazonaws.com/

  * Enable public access

    * Goto `Permissions` 

    * Disable `Block public access (bucket settings)`

    * Apply this settings to `Bucket policy`

      ```json
      {
          "Version": "2012-10-17",
          "Statement": [
              {
                  "Sid": "PublicReadGetObject",
                  "Effect": "Allow",
                  "Principal": "*",
                  "Action": "s3:GetObject",
                  "Resource": "arn:aws:s3:::myforms3/*"
              }
          ]
      }
      ```

      

  * Enable CORS to access external site

    * Goto `Permissions` 

    * Apply this setting to `Cross-origin resource sharing (CORS)` to allow `https://54e9e45d-c142-4c16-8467-bceb20cf68ca.mock.pstmn.io`

      ```json
      [
          {
              "AllowedHeaders": [
                  "*"
              ],
              "AllowedMethods": [
                  "PUT",
                  "POST",
                  "DELETE"
              ],
              "AllowedOrigins": [
                  "https://54e9e45d-c142-4c16-8467-bceb20cf68ca.mock.pstmn.io"
              ],
              "ExposeHeaders": []
          },
          {
              "AllowedHeaders": [],
              "AllowedMethods": [
                  "GET"
              ],
              "AllowedOrigins": [
                  "*"
              ],
              "ExposeHeaders": []
          }
      ]
      ```

      

