This project offers a reference for calling Amazon S3 REST API without using the AWS CLI or SDK.
It supports Signature Version 4
for signing AWS requests to S3 API. Sometimes, a client environment is restricted and
is unallowed to install any external packages or modules. In such a case, installing AWS CLI
or an AWS SDK such as Boto3 for Python is not feasible. Assuming Python runtime is available (which
is the case in most Unix-like OS environments), the s3.py
program from this project can be modified
and executed to invoke various S3 APIs.
The following S3 APIs are called from the program:
- PutObject
- GetObject
- DeleteObject
- ListObjects
- ListBuckets
- CreateBucket
- DeleteBucket
More APIs can be added easily to s3.py
by referencing the REST API syntax
documented here.
Note:
s3.py
has been tested with Python 2.7 and Python 3.7. Please report any issues running the code.
- Configure required environment variables
export AWS_ACCESS_KEY_ID=[your access key id]
export AWS_SECRET_ACCESS_KEY=[your access key secret]
export AWS_S3_BUCKET=[your bucket name]
- Clone this repo or download s3.py file, and copy to your Linux machine
- Run the program as
python s3.py
orpython2.7 s3.py
- MIT license
- Copyright 2020 © Sachin Hamirwasia