CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > How to > How To Enable Cross Account Access In AWS S3?

How To Enable Cross Account Access In AWS S3?

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Last updated: July 1, 2026 ยท 3 min read ยท 4 Comments
Share: in X

To access an Amazon S3 (Simple Storage Service) bucket from another AWS account, we need to set up cross account access permissions in S3. This typically involves configuring bucket policies.

If you already know the bucket policy in S3 then it will be easier for you. If you don’t know about it then don’t worry you can still enable access for another AWS account. ๐Ÿ™‚

In this post, I will explain how we can access Amazon S3 Bucket from another AWS Account.

Prerequisites

  1. Either you must have access right to both the account
    • Or 12 digits account number of account B
    • And the ARN of the Role/User from B who is going to access the bucket of account A.
  2. Access privilege of account A where you are going to modify the bucket policy.

Our Use Case

Let’s say, you have an account A and B in AWS.

And, you also have a bucket my-bucket-a in your account A and want to access it bucket from account B.

Solution to enable cross account access in AWS S3

I am dividing this solution steps into two parts. The first part is to get the ARN of the Role/User of account B which is going to access the bucket from account A. And, another is to apply bucket policy to my-bucket-a in account A. So that it will be easier to access S3 bucket from another AWS account.

First Part: Get User or Role ARN

  1. Login to your AWS account B.
  2. Go to IAM service.
  3. If you are going to give access to a particular user then go to the Access Management category and click Users.
    • You may see the list of users. Select one of them to whom you want to give access.
    • Copy the User ARN. It looks like: arn:aws:iam::your-12-digit-account-number:user/you-username-from-account-b
  4. If you are going to give access to a Role then go to the Access Management category and click Roles.
    • You may see the list of roles. Select one of them to whom you want to give access.
    • Copy the Role ARN. It looks like: arn:aws:iam::your-12-digit-account-number:role/service-role/your-rolename-from-account-b

Second Part: Apply Bucket Policy

  1. Login to your AWS account A.
  2. Go to S3 service.
  3. Select the bucket you want to update the policy. Ex: my-bucket -a
  4. Go to the Permissions tab
  5. Scroll down you may find the Bucket Policy and click on the Edit button.
  6. Now, edit the correct value to the following JSON content and paste it into policy and click on Save Changes button.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::your-12-digit-account-number:role/your-rolename-from-account-b"
            },
            "Action": [
                "s3:GetObject".
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::my-bucket-a/*"
        }
    ]
}

With this policy, the role from account B can upload and get the object from the bucket my-bucket-a.

To understand more on bucket policy, you can take a reference from the official document of the AWS.

Conclusion

In this post, we are able to access the bucket from another AWS account.

We also learn to update the policy in S3 bucket.

Related Posts:

  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • Host Static Website on S3 AWS: Step-by-Step Guide
  • Setting Up an EC2 Instance with Amazon CloudFront…
  • Most Frequently Asked Spring Boot Interview…
  • Create an IAM user in AWS
  • Identifiers in Java
Tags:awsdevopss3
Was this article helpful?
โ† Previous ArticleHow to get AWS Region in Cloudformation template?
Next Article โ†’How to create user in MySQL for remote access?

4 thoughts on “How To Enable Cross Account Access In AWS S3?”

  1. Jyothika
    December 21, 2023 at 7:30 pm

    I had a requirement to access from my Jenkins server to another account’s S3 bucket. Following the steps given here It worked. Thank you sir for your easy to follow steps.

    Log in to Reply
    • Coder Sathi
      January 7, 2024 at 11:13 pm

      I’m happy to hear that the steps provided in the blog were helpful for you in accessing the S3 bucket from your Jenkins server.

      Log in to Reply
  2. Pruthvi
    May 3, 2022 at 3:51 am

    Hi I’m trying to read s3 object from AccountB and restore in RDS and I’m keep receiving this error? Any thoughts.

     [2022-05-02 14:25:22.140] Aborted the task because of a task failure or a concurrent RESTORE_DB request. 
     [2022-05-02 14:25:22.177] Task has been aborted [2022-05-02 14:25:22.180] Error making request with Error Code 
     Forbidden and Http Status Code Forbidden.
     No further error information was returned by the service.

    Log in to Reply
    • Coder Sathi
      May 3, 2022 at 12:26 pm

      The steps given above are well-tested. So, if you’ve followed the steps given in the post you should be able to access the S3 object from AccountB. I haven’t done restoring part from another account yet but you can check these links if you haven’t already. Restoring a backup into a MySQL DB instance and you can also check the accepted answer from the link: Restore a backup file on AWS RDS SQL Server from S3 bucket

      Let me know if this information helped you.
      Thanks

      Log in to Reply

Leave a Comment Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to implement Passwordless Authentication in Spring Boot: A Step-by-Step Guide
  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Linkedin

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
ยฉ 2026 CoderSathi. All rights reserved. Privacy Policy ยท Sitemap