Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Bobcares Logo
Search Call 1-800-383-5193 Emergency Contact
Emergency Contact

COPY or UNLOAD data from Amazon Redshift to Amazon S3 bucket

by Jiji Jose | Aug 8, 2021 | Amazon Web Services (AWS), Latest | 0 comments

Wondering how to COPY or UNLOAD data from Amazon Redshift to Amazon S3 bucket? We can help you!

Here, at Bobcares, we often handle similar requests from our AWS customers as a part of our AWS Support Services.

Today, let’s see how our Support Engineers help our customers to COPY or UNLOAD data from Amazon Redshift to Amazon S3 bucket.

 

COPY or UNLOAD data from Amazon Redshift to Amazon S3 bucket

 
We can access Amazon S3 data that is present in a different account from where Amazon Redshift account that we are using.

Our Support Engineers follows the below steps to perform this task:

  1. At first, we should create an IAM role in the AWS S3 account(RoleX)

2. Then, we should create an IAM role in the Amazon Redshift Account(RoleY)

3. And finally, we have to test the cross-account access between RoleX and RoleY.

 

Creating an IAM role in the S3 account(RoleX)

 
Let’s see the steps followed by our support techs to create an IAM role in the AWS S3 account.

  1. Log in to the AWS Management Console and open the IAM console.

2. Select Policies and then click Create Policy.

3. Click the JSON tab.

4. Then add the following policy document :

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:Encrypt",
"kms:GenerateDataKey"
],
"Resource": [
"<KMS_KEY_ARN_A_Used_for_S3_encryption>"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:Get*",
"s3:List*"
],
"Resource": [
"arn:aws:s3:::<bucketname>",
"arn:aws:s3:::<bucketname>/*"
]
}
]
}

Here, replace the <bucketname> with the actual bucket name.

5. Then click Review policy.

6. Enter the policy name (e.g. RoleX_access)

7. Then, click Create policy to create the policy.

8. From the dashboard, select IAM and then select Roles.

9. Select Create role.

10. Select Another AWS account as the trusted entity type.

11. Then, enter the AWS account ID of the account that’s using Amazon Redshift.

12. Select Next: Permissions, and then select the policy that we created.

13. Select Next: Tags, and then select Next: Review.

14. Enter a role name (RoleX).

15. Click Create role.
 

Creating an IAM role in the Amazon Redshift account(RoleY)

 
Now, let’s see the steps to create an IAM role in the Amazon Redshift account with permissions to assume RoleX.

  1. Log in to the AWS Management Console and open the IAM console.

2. Select Policies and then click Create Policy.

3. Click the JSON tab.

4. Then add the following policy document :

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CrossAccountPolicy",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "<S3AccountRoleARN>"
}
]
}

Here, replace the <S3AccountRoleARN> with the ARN for RoleA.

5. Then click Review policy.

6. Enter the policy name (e.g. RoleY_access)

7. Then, click Create policy to create the policy.

8. From the dashboard, select IAM and then select Roles.

9. Select Create role.

10. Select AWS service as the trusted entity type.

11. Select Redshift and then select Redshift – Customizable.

12. Select Next: Permissions, and then select the policy that we created.

13. Select Next: Tags, and then select Next: Review.

14. Enter a role name (RoleY).

15. Click Create role.

16. Then we should associate the IAM role (RoleY) with the Amazon Redshift cluster.

To associate the IAM role (RoleY) with the Amazon Redshift cluster:

  1. Log in to the AWS console and open Reshift Console.

2. Select CLUSTERS, then select the name of the cluster.

3. Select Actions and then select Manage IAM roles.

4. Then we can either select Enter ARN and then enter an ARN or an IAM role.

5. Or select an IAM role from the list. Then select Add IAM role to add it to the list of Attached IAM roles.

6. Click Done to associate the IAM role with the cluster.

The chaining of IAM roles in Redshift gives Amazon Redshift access to Amazon S3.
 

Test the cross-account access between RoleX and RoleY

 
Now let’s see how to test the cross-account access between RoleX and RoleY.

  1. First, we should run the COPY command to bring the data from the AWS S3 bucket to Amazon Redshift:
copy table_name from 's3://<bucketname>/crosscopy1.csv' iam_role 'arn:aws:iam::Redshift_Account_ID:role/RoleY,arn:aws:iam::S3_Account_ID:role/RoleX' delimiter ',' removequotes;

Replace the below values in the COPY command:

table_name: The Redshift table that we want to copy the Amazon S3 data into.

s3://<bucketname>/crosscopy1.csv: The S3 bucket that we want to copy the data from.

Redshift_Account_ID: The AWS account ID for the Redshift account

RoleY: The second IAM role we created.

Role X: The first IAM role we created.

S3_Account_ID: The AWS account ID for the S3 account

2. Then, we should run the UNLOAD command to unload the data from Amazon Redshift to the AWS S3 bucket.

unload ('select * from table_name') to 's3://<bucketname>/folder/table_name_' iam_role 'arn:aws:iam::Redshift_Account_ID:role/RoleY,arn:aws:iam::S3_Account_ID:role/RoleX' KMS_KEY_ID 'ARN_KMS_KEY_ID' ENCRYPTED;

Replace the below values in the UNLOAD command:

table_name: The Redshift table that we want to unload to the Amazon S3 bucket.

s3://<bucketname>: The S3 path to unload the Redshift data.

Redshift_Account_ID: The AWS account ID for the Redshift account

RoleY: The second IAM role we created.

RoleX: The first IAM role we created.

S3_Account_ID: The AWS account ID for the S3 account.

Important Notes:

  • All the steps will work in any case. But there may be changes in COPY or UNLOAD command syntax.
  • The above steps suppose that the  Redshift cluster and the Amazon S3 bucket are in the same region, If not, we must add the region parameter with the COPY or UNLOAD command.
  • The AWS KMS permissions are not needed if the Amazon S3 bucket is not encrypted with the AWS-KMS key.

[Need help with more AWS queries? We’d be happy to assist]
 

Conclusion

 
To conclude, today we discussed how our Support Engineers help our customers to COPY or UNLOAD data from Amazon Redshift to Amazon S3 bucket.

Submit a Comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • What Is Proactive Monitoring? A Complete Guide
  • AI Use Cases: How Artificial Intelligence Is Used Across Industries
  • Turn Manual Business Processes into Automation-Driven Growth
  • Digitalization of Business to Speed Up Operations and Support Faster Scaling
  • Cloud Cost Optimization Best Practices: Everything You Need to Know in 2026

Categories

  • Advanced Vulnerability
  • AI Services
  • AI Support
  • AIOps
  • Amazon Web Services (AWS)
  • Apache
  • API Integration
  • Application Development
  • Azure
  • Cloud Cost Optimization
  • Cloud Management
  • Cloud-Native Application
  • Cloudflare
  • cPanel
  • cPanel migration
  • Cyberpanel
  • DDoS
  • Development Service
  • DevOps
  • DevOps Consulting
  • DevSecOps
  • Digital Transformation
  • DigitalOcean
  • DirectAdmin
  • Docker
  • Drupal
  • Ecommerce
  • Filezilla
  • FTP
  • Google cloud platform
  • HAProxy
  • Headless CMS Integration
  • Hosting Support
  • IIS
  • Infrastructure Management & Optimization
  • Kubernetes
  • KVM
  • Laravel
  • Latest
  • Linode
  • Litespeed
  • LXC/LXD
  • Magento
  • Mobile App Development
  • MongoDB
  • Moodle
  • MySQL
  • NFS
  • Nginx
  • OnApp
  • Outsourced Support
  • OVH
  • ovirt
  • pfsense
  • Plesk
  • PostgreSQL
  • PowerDNS
  • Product Engineering
  • Proxmox
  • RedHat
  • Redis
  • Sendmail
  • Server Administration
  • Server Management
  • Software Development
  • Software Testing
  • SQLServer
  • Technical Support
  • UI/UX
  • Virtualizor
  • VMware
  • VPN
  • Vulnerability Scanning
  • Vultr
  • Web Development
  • Windows
  • WordPress
  • WordPress Hosting
  • WordPressHA

Subscribe to our newsletter

Footer newsletter

Email sales@bobcares.com | Phone 1-800-383-5193

Product Engineering

  • MVP Build
  • MVP to Scale
  • Product Maintenance

Digital Transformation

  • Process Digitization & Automation
  • Systems Integration & Workflow Orchestration
  • Data Enablement & Decision Support
  • Application & Platform Modernization
  • Transformation Execution & Delivery Enablement

AI Services

  • AI Readiness & Use-Case Discovery
  • AI Integration & Application Enablement
  • Intelligent Automation & AI Workflows

Infrastructure Management

  • Always-On Infrastructure Management
  • Proactive Monitoring & Incident Prevention
  • Cloud Cost Control & Optimization (FinOps)
  • Outsourced IT & End-User Support
  • Managed Infrastructure Execution Support

DevOps & Automation Services

  • CI/CD & Release Automation
  • Infrastructure as Code & Platform Standardization
  • Reliability Engineering & Observability
  • DevSecOps Enablement
Product Engineering +
Web Development MVP to Scale Builds Microservices Architecture Agile & Dev Team Augmentation Mobile Apps Ecommerce UI/UX Design QA & Test Automation
Digital Transformation +
Legacy Modernization Workflow Automation Data-Driven Dashboards CRM / ERP Integration Business Process Re-engineering
AI Services +
AI & Machine Learning AIOps Intelligent Automation Business Intelligence & Analytics AI Installation & Compute
Infrastructure Management +
Cloud Setup Cloud Migration Managed Cloud Services Server & Hosting Cost Optimization Performance Optimization Outsourced Support
DevOps & Automation Services +
CI/CD Setup Kubernetes & Docker Infrastructure as Code Cloud-Native Migration DevSecOps
Cybersecurity & Compliance Services +
Security Hardening VAPT Incident Response Backup & DR

© 2026 Bobcares. All Rights Reserved.

  • Careers
  • |
  • Cookie Policy
  • |
  • GDPR
  • |
  • Privacy Policy
  • |
  • Terms and Service
  • LinkedIn
  • YouTube
  • Instagram
  • Facebook

Preview of the new Bobcares experience
NEW UPDATE
See What’s New
at Bobcares

Discover a faster, clearer view of our services and expertise.


Explore the New Experience
Arrow Right