If you have installed AWS CLI and search around for CLI solutions to perform object storage operations, you will realised that there are 2 version. Namely s3 and s3api commands.
In a short summary, s3 commands provide high level functionalities that make managing S3 objects easier while s3api commands directly maps itself of the low level API in AWS services. Example of listing operation showing here where s3 and s3api is utilised for different use case.
Before we go into the details, please ensure that you have the latest version of AWS CLI installed by referring to AWS documentation.
s3api Command
Each of the s3api command maps itself with low level APIs referencing to the different AWS services. Hence, you can perform smaller operations with s3api. However, this also means that more logic may be needed to process data after the command.
Let’s look at a few example of s3api commands.
# Create bucket
aws s3api create-bucket --bucket my-bucket
# List objects in a bucket
aws s3api list-objects --bucket my-bucket
# Get bucket logging
aws s3api get-bucket-logging --bucket my-bucket
You may refer to this document for the full list of s3api commands.
s3 sCommand
Although there are lesser s3 commands compare to s3api commands, these s3 commands comes with more capabilities that is hidden from users. Thus, there may not be a need for you to worry about speed if you use this. Here is a comparison article dated 2014 for more in depth.
Let’s look at a few example of s3 commands.
# List objects in a bucket
aws s3 ls s3://my-bucket/
# Copy File
aws s3 cp my-file.txt s3://my-bucket/my-file.txt
You may refer to this document for the full list of s3api commands.
Operations
Conclusion
At the start, you may get confuse on which command to use. I would personally recommend to start with s3 commands since there are several advantages. But if you need to perform operation more targeted to an area, then can consider s3api.
No Responses Yet