Common Scenarios
We gonna demonstrate the common scenarios we might come through, that we can do with AWS S3, do hands-on with the below commands.
1. Uploading a Local Directory to S3:
aws s3 cp /path/to/local/directory s3://your-bucket-name/ --recursive --profile <myprofile>
This command copies the entire directory /path/to/local/directory and its contents to your S3 bucket named your-bucket-name, we can slo filter the files to be uploaded using the additional parameters discussed in further sections below.
2. Downloading a Directory from S3:
aws s3 cp s3://your-bucket-name/directory-path /path/to/local/destination --recursive --profile <myprofile>
This command downloads the directory named directory-path from your S3 bucket your-bucket-name and places it in the local directory /path/to/local/destination, we can use this command whenever we need to copy our s3 data to local or viceversa, using this we need not follow traditinal steps like compressing the data, downloading the zip/tar file and then extracting stuff, s3 simplifies the process.
3. Upload current directory to S3
To upload the all files in the current directly we can use source location as ‘.’ and use recursive, below is the sample command to do so.
aws s3 cp . s3://your-bucket-name/ --recursive --profile <myprofile>
AWS S3 CP Recursive
Amazon Web Services (AWS) is a comprehensive cloud computing platform offering many services, including storage, computing, databases, and more. Amazon S3 (Simple Storage Service) is a scalable object storage service from AWS. S3 provides a highly durable and cost-effective platform for storing various data types, including documents, images, videos, backups, and archives. S3 has different pricing models based on the frequency of accessing those objects. You can access your S3 data from anywhere with an internet connection, making it ideal for various cloud-based applications.