Set up an AWS Transfer Family web app

TUTORIAL

Task 2: Set up cross-origin resource sharing (CORS)

In this task, you will create an HAQM S3 bucket and set up cross-origin resource sharing (CORS). This S3 bucket will be used to store data by the user.

Implementation

In this task, you will create an HAQM S3 bucket and set up Cross-origin resource sharing (CORS). This S3 bucket will be used to store data by the user.

 Time to complete

5 minutes

 Requires

  •  1. Open HAQM S3 console and choose Create bucket.

    2. For Bucket name, enter a descriptive, globally unique name.

    • For example, transfer-family-web-app-demo-<your-username>.

    3. You can leave the remaining options as defaults. Navigate to the
    bottom of the page and choose Create bucket.

  • 1. After the bucket is created, on the General purpose buckets tab, search for the bucket you created, select the Name. Then, choose the Permissions tab.

    2. In Cross-origin resource sharing (CORS), choose Edit and paste in the following code.

    3. Replace AccessEndpoint with the actual InstanceARN you copied in the previous task.

    • Note: Do not enter trailing slashes because trailing slashes will cause errors when users attempt to log into the web app.
      • Correct example: http://webapp-b4d851af6e314fc39.transfer-webapp.us-west-2.on.aws
      • Incorrect example: http://webapp-b4d851af6e314fc39.transfer-webapp.us-west-2.on.aws/

     3. Choose Save changes.

    [
      {
        "AllowedHeaders": [
          "*"
        ],
        "AllowedMethods": [
          "GET",
          "PUT",
          "POST",
          "DELETE",
          "HEAD"
        ],
        "AllowedOrigins": [
          "AccessEndpoint"
        ],
        "ExposeHeaders": [
          "last-modified",
           "content-length",
          "etag",
          "x-amz-version-id",
          "content-type",
          "x-amz-request-id",
          "x-amz-id-2",
          "date",
          "x-amz-cf-id",
          "x-amz-storage-class",
          "access-control-expose-headers"
         ],
        "MaxAgeSeconds": 3000
      }
    ]
    

Conclusion

In this task, you’ve learned how to create an S3 bucket and set up cross-origin resource sharing (CORS).

Task 3: Create the instance