AWS S3 is a widely used cloud-based storage service. You can directly attach your public and private S3 buckets to ImageKit. Once that is done, you would be able to access all the images in your S3 bucket via ImageKit using image URLs. Each image would get optimized and resized as per the default ImageKit settings and URL transformation parameters.

Here are the steps that you need to follow to attach your S3 bucket to ImageKit and start delivering optimized images from that bucket instantly.

Steps for optimizing images in an AWS S3 Bucket with ImageKit

1. ImageKit needs read-only access to your S3 bucket. You can achieve this by using AWS Identity and Access Management (AIM) policy for your S3 bucket.

Ideally, you should create a separate user for this purpose and assign the IAM policy for that particular user and the required buckets only. Note that you need to provide permission for the operation s3::GetObject on the objects in your bucket. The minimal permission policy should look like:

  "Sid": "VisualEditor1",
  "Effect": "Allow",
  "Action": [
  "Resource": [

You can reference below articles to learn more about granting read-only access to your S3 bucket using AWS IAM policy.

Writing IAM Policies: How to Grant Access to an Amazon S3 Bucket

Examples - Managing access on S3 Bucket

2. Once access has been granted using IAM policies, then note down the AWS Access Key and AWS Secret Key for this. We will use this in the ImageKit dashboard to attach the bucket.

3. Log in to your ImageKit dashboard. Go to the Integration Section.

4. AWS S3 Bucket is supported as an origin in ImageKit. Click on "Add origin" button

5. In the form that opens up, select “Amazon S3” as the “Origin Type”. You can give this source any “Origin Name”. Origin Name is to help you identify this origin and has no impact on access or performance. Below, we are using the name "Test Bucket" and using some sample values to demonstrate adding an S3 bucket as origin.

6. Provide the bucket name in the “S3 Bucket Name” field. The images in your S3 bucket could have a fixed prefix (i.e. they appear inside a particular folder). If that is the case, then you can specify the full prefix to your images in the “S3 Bucket Folder” field. If your images are present at the base or root of your S3 bucket then you can enter “/” here.

7. Use the Access Key and the Secret Key for the user you created in step 1 in the “S3 Access Key” and “S3 Secret Key” fields respectively.

8. Click on “Submit".

9. The first image origin that you add is automatically added to the list of origins accessible through the default URL endpoint i.e. you can modify this by editing "origin sequence". You can either continue to use the “Default URL endpoint” or create a new URL endpoint if you want to manage multiple image origins with ImageKit.


ImageKit does not download objects from the S3 storage to optimize images. Whenever you request an image in your S3 bucket, using an ImageKit URL and when the image is not available in ImageKit’s storage, only then will it get the image from the S3 bucket. Image optimization and transformation is done in real time. 

What next?

Now that you have successfully configured ImageKit to fetch images from your S3 bucket, you might want to understand image url construction in ImageKit and start delivering resized and optimized images.


In case you have any questions, please create a support ticket from your dashboard or if you are on a paid plan, start a conversation by clicking on the chat icon in the bottom right.

Did this answer your question?