Before your EC2 instance can talk to S3, it needs permission. Instead of using hardcoded access keys—which is a security risk—you should use an IAM Role for EC2 .
SSH into your Linux instance or RDP into your Windows instance. Verify the AWS CLI is installed and can see your bucket: Grant an EC2 instance access to an S3 bucket - AWS re:Post download s3 bucket to ec2
Downloading data from an Amazon S3 bucket to an EC2 instance is a foundational task for many AWS workflows, from deploying application code to processing large datasets. Using the AWS Command Line Interface (CLI) is the most efficient and secure method for this transfer. Step 1: Granting Permissions (IAM Roles) Before your EC2 instance can talk to S3, it needs permission
: In the EC2 console, select your instance, go to Actions > Security > Modify IAM Role , and attach the role you just created. Step 2: Connect and Verify Verify the AWS CLI is installed and can
: In the IAM Console , create a new role and select EC2 as the trusted service.
: Attach the AmazonS3ReadOnlyAccess policy (or AmazonS3FullAccess if you need to upload as well).