Date Published: October 23, 2024
Managing Your S3 Buckets with s3cmd
Acquia makes available the s3cmd
command line utility to manage Amazon S3 Buckets.
If you encounter either of these errors using the s3cmd --configure
command:
ERROR: Test failed: 400 (InvalidToken): The provided token is malformed or otherwise invalid.
ERROR: Test failed: 403 (SignatureDoesNotMatch): The request signature we calculated does not match the signature you provided. Check your key and signing method.
then you can follow the next steps as a workaround:
- Create an IAM user in your S3 console, or visit the permissions for an existing IAM user.
- Make sure the IAM user has the permissions to do things you want the `s3cmd` to do. For example, `ListAllMyBuckets` is required for `s3cmd ls`.
- In the IAM user's "Security credentials" tab, create a new Access Key ID. You can only have two access keys for one user. If you need more keys, create another IAM user.
- Create Environment Variables for the ID and key. Use
AWS_ACCESS_KEY_ID
as the label for the access key ID, and AWS_SECRET_ACCESS_KEY
for the secret access key. The variables will be available to you in your Drupal application and via SSH, i.e. s3cmd
(in new shell after you create the environment variables).
Once you've followed the above steps, try it out: s3cmd ls
will list all of your buckets. You can also run s3cmd --help
to list all the commands possible.
Note that:
- You will be interacting with buckets outside of Acquia's control, so our support will be limited to troubleshooting some of the above steps.
- The s3cmd executable on the platform is provided as a courtesy. If it is outdated or buggy you can seek alternative methods to interact with your S3 Buckets.
We recommend referring to https://s3tools.org/s3cmd-howto for additional information.
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.