This tool is a minimalist replacement for aws
, the command line interface to Amazon Web Services. It's implemented in Bash with only a few dependencies to other tools. The requests to the AWS API endpoints are done with curl.
It can be used for example together with lightweight Linux distributions such as Alpine Linux to build very small docker images. It only supports a very limited number of commands and options but for these commands and options it aims to be as close as possible to the original. For example
aws s3 cp foo.css s3://some-bucket/ --content-type text/css
can be replaced with the exact same commands/options
aws-micro s3 cp foo.css s3://some-bucket/ --content-type text/css
This tool is not associated with Amazon in any way.
Download the latest release, move it to some convenient location (e.g. /usr/local/bin/
), set the environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
and you're ready to go.
Make sure you have required unix tools installed. Assuming a fresh installation of macOS and minimal docker container images for the Linux distributions, you need to install:
OS | required packages | optional packages |
---|---|---|
macOS | - | - |
Rocky Linux | openssl | file |
Ubuntu | openssl, curl | file |
Debian | openssl, curl | file |
Alpine Linux | openssl, curl, bash | file |
The package file
is needed for content type detection.
If you clone the repo, be aware that aws-micro
sources additional files and can only be run from the repo directory. The release version has everything merged into one single file.
Supported services: s3
, s3api
, sts
Configuration settings and credentials set in ~/.aws
are ignored, with the exception of profiles (see below).
The path to the configuration file can be set with AWS_CONFIG_FILE
. It defaults to $HOME/.aws/config
.
Credentials must be configured via the environment variables AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
.
The region can be set either via command line option or AWS_DEFAULT_REGION
.
The output of aws-micro
will in many cases differ from aws
.
The s3 commands work also with S3-compatible services like minio and probably others.
For a detailed description of the commands and option have a look at the aws-cli documentation.
Global options:
--debug (boolean)
--dryrun (boolean)
(Contrary to `aws` this will work on all commands)
--endpoint-url (string)
--profile (string)
(only `role_arn` in combination with `credential_source=Environment` is currently supported, no
caching of temporary credentials)
--region (string)
--version (string)
--no-sign-request (boolean)
aws-micro
will only use virtual-hosted–style requests when used with AWS. This could break e.g. requests to buckets with .
in the name. If a custom endpoint-url is set, a path-style request is used. See https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html and https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/
S3Uri with S3 access points are not supported.
The content type detection will differ from aws
. aws-micro
should be able to detect more file types because it uses the file
command which utilizes libmagic. See also https://github.com/aws/aws-cli/issues/2163. If file
is not available no content type is set and a warning is print.
cp <LocalPath> <S3Uri> or <S3Uri> <LocalPath>
Not supported:
cp <S3Uri> <S3Uri>
Options:
--acl (string)
--no-guess-mime-type (boolean)
--sse (string)
--storage-class (string)
--content-type (string)
ls <S3Uri> or NONE
Output date/time will always be in UTC while aws
would calculate the date/time for your timezone.
No additional option supported.
Known bugs:
<NextContinuationToken>
in the response), only the keys of the first response are shown and no further requests are done.mb <S3Uri>
create-bucket
Options:
--bucket <value>
head-object
Options:
--bucket <value>
--key <value>
assume-role
Options:
--role-arn <value>
--role-session-name <value>
The output is in XML while aws
will transform the output to JSON.
All notable changes to this project will be documented here.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
date
detection~
instead of $HOME
. The latter would result in an error in environments like AWS Lambda where $HOME
is not sets3api head-object
implemented.s3 mb
implemented.openssl sha256
to support Rocky Linux 9.s3api create-bucket
implemented.sts assume-role
implemented.--acl
for s3 cp
implemented.--no-guess-mime-type
for s3 cp
implemented.--sse
for s3 cp
implemented.--storage-class
for s3 cp
implemented.--no-sign-request
implemented.--profile
implemented.AWS_CONFIG_FILE
supported.file
is missing, no content type is set and a warning is print.bucket.s3.us-east-1.amazonaws.com
) instead of the global one.AWS_DEFAULT_REGION
was ignoredPull requests are welcome. The unit tests are written with https://github.com/bats-core/bats-core. Run with bats tests/
. Make use of the excellent tool shellcheck
(https://www.shellcheck.net/). Run with shellcheck -x -a aws-micro
.
Copyright 2020 Thilo Uttendorfer
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.