Skip links
🔧
Need help with installation?
Send an email to [email protected] to get a quote.

AWS S3 Storage Setup

Table of Contents

In MagicAI, you can host your images on Amazon Web Services instead of hosting them on your local server.

Setting up AWS S3

  1. Go to aws.amazon.com
  2. If you have an AWS account, log in to your account.
    If you don’t have an account, you can get help from this article to create one.
  3. Create an IAM user on AWS with full access to Amazon S3.
    Check out this article if you don’t know how.
  4. Create an S3 bucket. Check out this article if you don’t know how.
    • Make sure you allow public access.
      (Do not select “Block all public access” option.)
    • Apply the required policy and CORS configurations as described below.
      • Bucket Policy configuration
        {
        "Version": "2012-10-17",
        "Statement": [
        {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:*",
        "Resource": "arn:aws:s3:::magicai-image/*"
        }
        ]
        }

         
      • CORS configuration
        [
        {
        "AllowedHeaders": [
        "*"
        ],
        "AllowedMethods": [
        "POST",
        "GET",
        "PUT",
        "DELETE",
        "HEAD"
        ],
        "AllowedOrigins": [
        "*"
        ],
        "ExposeHeaders": []
        }
        ]

  5. That’s all, let’s configure MagicAI now.

Configuring MagicAI for AWS S3

  1. Open your .env file in the root directory of MagicAI with a text editor.
  2. Add the following values to your .env file and enter your corresponding AWS S3 details.
    AWS_ACCESS_KEY_ID=
    AWS_SECRET_ACCESS_KEY=
    AWS_DEFAULT_REGION=
    AWS_BUCKET=
    AWS_USE_PATH_STYLE_ENDPOINT=false


    AWS_ACCESS_KEY_ID: Public key generated by IAM user.
    AWS_SECRET_ACCESS_KEY: Secret key generated by IAM user.
    AWS_DEFAULT_REGION: Your region in AWS.
    AWS_BUCKET: Your S3 bucket name.

  3. Now just set the default storage to AWS S3 from Settings > Storage page in your MagicAI dashboard.
  4. That’s all!