Skip to main content
Version: 2024

Amazon S3 bucket as file cache

Use an Amazon S3 bucket as file cache

To use an Amazon Simple Storage Service (Amazon S3) bucket as a file cache for Indicium to store files, you must take the following steps:

Step
Create an Amazon S3 bucket
Block public access
Disable bucket versioning
Clear the file cache periodically
Use an S3 bucket as a file cache
Create a user with programmatic access

Create an Amazon S3 bucket

To create an Amazon S3 bucket:

  1. Open the AWS console.
  2. Search for 'S3', and select the resulting S3 page.
  3. On this page, click Create bucket.
  4. In the setup page, enter a Name and a Region where the data will be stored.

Block public access

It is strongly recommended to select the Block all public access setting for safety purposes. When creating a bucket, public access is blocked by default, so you can leave this setting as it is:

Public access settings from creation screen Block all public access setting

Disable bucket versioning

To ensure the deletion of files will work as expected, you must disable Bucket Versioning in the creation screen of the S3 bucket. Bucket versioning is disabled by default, so you can leave this setting as it is:

Bucket versioning settings from creation screen Bucket versioning settings from the creation tab

Clear the file cache periodically

To clear the file cache periodically, follow these steps.

We recommend clearing files every seven days to keep the cache clean and the costs low.

Use an S3 bucket as a file cache

To use an S3 bucket as a file cache for Indicium, you first need to create a user with programmatic access. If such a user exists, you can skip this part and continue with Create an ElastiCache Redis cache.

Create a user with programmatic access

To create a user with programmatic access:

  1. In the AWS Management Console, select IAM.

  2. In the menu on the left-hand side, select Users.

  3. Click Add users on the right-hand side. The Add user screen opens.

  4. In this screen, select AWS credential type: Access key - Programmatic access.

  5. If password access is necessary, select Password - AWS Management Console Access.

  6. Click Next.

    Add User Add user

  7. On the next page, select Create group. A popup dialog opens.

  8. Enter a Group name.

  9. Click Create policy (a new browser tab will open).

  10. Copy the following policy to the JSON tab.

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Sid": "VisualEditor0",
    "Effect": "Allow",
    "Action": [
    "s3:PutObject",
    "s3:GetObject",
    "s3:GetObjectAttributes",
    "s3:ListBucket",
    "s3:DeleteObject"
    ],
    "Resource": [
    "arn:aws:s3:::<bucket_name>",
    "arn:aws:s3:::<bucket_name>/*"
    ]
    }
    ]
    }
  11. Replace both occurrences of <bucket_name> with the name of the S3 bucket.

  12. Click Next: Tags and Next: Review.

  13. Provide a policy name.

  14. Click Create policy.

  15. Close the browser tab and return to the Create group browser tab.

  16. Click Refresh.

  17. Select the policy you just created.

  18. Click Create group.

    Create group Create group

  19. Select the newly created user group.

  20. Click Next.

  21. Optionally, you can add tags.

  22. Click Next.

  23. Click Create User.

  24. This screen displays the Access key ID and Secret Access Key. Add the corresponding values to the appsettings.json configuration file:

"FileCache": {
"Type": "AWSS3",
"AWSRegion": "<Bucket region>",
"AWSAccessKeyID": "<Access key ID>",
"AWSSecretAccessKey": "<Secret Access Key>",
"AWSBucketName": "<Bucket name>"
}

Now, the S3 bucket is added as a file cache to Indicium.

Was this page helpful?