S3 is a pretty cheap service for file storage. According to S3 pricing it is only
$0.023 per GB if you use default S3 Standard storage class. Also, S3 has even cheaper storage class - called S3 One Zone - Infrequent Access, which costs
$0.01 per GB. The difference only in SLA which is the percentage of successful requests to access the data (availability):
- S3 Standard: 99.0% — 99.9%
- S3 One Zone - Infrequent Access: 98.0% — 99.0%
Availability is not the same as the data storage durability, which is
99.999999999% for all storage classes.
Here we will provide simple CLI instructions to create a bucket and upload a file with several commands. First, install AWS CLI:
sudo pip install --upgrade awscli
For this you need python on Linux, or you can use python in WSL for Windows
Enter your credentials from AWS Web Console. You can create new credentials in IAM section.
Create a bucket:
aws s3api create-bucket --bucket bucketname
aws s3 cp /path/to/file.zip s3://bucketname/
If you want to apply another storage class for the file you have to pass
storage-class param `, for example:
aws s3 cp /path/to/file.zip s3://bucketname/ --storage-class ONEZONE_IA
Currently uploaded file is still private so nobody apart from you or people who have permissions from your account could access it.
The recommended and secure way to share the files is generating so-called pre-signed URLs. Let's generate URL for
aws s3 presign s3://bucketname/file.zip --expires-in 360000
To list files in the bucket you can use next command:
aws s3 ls s3://bucketname/