How to Configure an Amazon S3 Bucket

Description

Amazon S3 Buckets can be used to store files, such as images or documents. S3 Buckets can also be used with AlphaLaunch to host application installation files.

Setting the CORS Policy

Before you can upload files to Amazon S3, you must configure your Amazon bucket to allow CORS support. CORS (Cross-Origin Resource Sharing) allows you to make callbacks to a different server than the server from which the page was originally loaded (your Alpha server). To configure your bucket you will need to open the AWS console.

To configure the CORS policy on an Amazon S3 Bucket, open the Amazon Web Services Management Console, select the bucket, then click the Properties button. From the Properties screen, open the Permissions section. Then, click the Edit CORS Configuration button.

Below is a sample configuration that can be pasted into the configuration dialog:

[
   {
       "AllowedHeaders": ["*"],
       "AllowedMethods": ["PUT","POST","DELETE"],
       "AllowedOrigins": ["*"],
       "ExposeHeaders": ["x-amz-server-side-encryption","x-amz-request-id","x-amz-id-2"],
       "MaxAgeSeconds": 3000
   }
]

Accessing PDFs Stored in a Bucket

To view PDFs stored in an S3 Bucket using a control like the PDF Viewer, your CORS policy needs to allow the 'GET' method. 'GET' allows Alpha Anywhere to read the PDF file from the bucket. For example:

[
    {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["PUT","GET"],
        "AllowedOrigins": ["*"],
        "ExposeHeaders": ["x-amz-server-side-encryption","x-amz-request-id","x-amz-id-2"],
        "MaxAgeSeconds": 3000
    }
]

See CORS configuration (AWS) to learn more about CORS configuration.

Setting a Bucket Policy

The S3 buckets used with Alpha Anywhere must have a CORS policy set. The Block all public access and Block public access granted through new access control lists must be disabled, as shown in the image below.

Bucket permissions
Bucket permissions

The Bucket policy can be set in the Amazon AWS management console and it will look something like this:

{
    "Id": "Policy1513279106848",
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1513279094040",
            "Action": [
                "s3:GetObject"
            ],
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::your-bucket-name/*",
            "Principal": "*"
        }
    ]
}

Additional Resources

For more information on how to create and configure Amazon S3 Buckets, refer to Amazon's documentation.

See Also