Oftentimes, we would want to manually copy files from an S3 to an EC2 instance in AWS. This is possible but requires several steps and some configuration.
1. Create IAM Role For EC2 Instances
First, create a new role. This role has read-only access to S3 buckets. We will assign this role to our EC2 instances later.
On the Identity and Access Management (IAM) page, go to Roles.
Then, click the Create Role button.
Affix the AmazonS3ReadOnlyAccess permission policy to our new role.
We can create tags for our new role. However, we will skip that for this post.
Then, provide an appropriate name for the new role. For this post, we use S3-EC2-readonly.
Once we successfully created the role, it will be available in the list of roles.
2. Create an S3 Bucket
Next, we need to create an S3 bucket and configure it.
Upload a file to the S3 bucket.
3. Create EC2 Instance
Create an EC2 instance and assign it the S3-EC2-readonly IAM role.
4. Copy Files Manually From S3 To EC2 Using SSH
Copy files manually from S3 to EC2 using SSH.
Create a directory and CD into it. Perform manual copy using:
1 | aws s3 cp --recursive s3://turreta-sg-s3-bucket . |
And that is how we copy files manually from S3 to EC2 in AWS!