How to use S3 storage for Amazon EC2 instances?

1.0K    Asked by JamesSCOTT in AWS , Asked on Jun 1, 2020
Answered by James SCOTT

Amazon EC2 machines are virtual machines hosted on AWS Cloud. These virtual machines have virtual volumes attached to them, and these virtual volumes can be instance type or EBS type. EBS or Elastic Block Store is Amazon AWS offering for block storage. There are a couple of commands to connect between S3 storage and EC2 instance. First is aws s3 cp. This command copies files back and forth between AWS S3 and EC2 instances. It accepts the source and the destination and then copies the source to the destination. As the source or destination, S3 object or a local file is specified. Also note, S3 buckets are shared among several EC2 instances, so any EC2 machine having the right credentials is able to read and write to S3 buckets. This is not the case for Amazon EBS volumes. EBS volumes can only be mounted to a single EC2 machine at a given time. The second command which copies data across S3 and EC2 is a sync command. So, the sync command recursively copies files from the source directory to the destination. It does not create empty folders in the destination.


Your Answer

Interviews

Parent Categories