- 09 Apr 2024
- Print
- PDF
AWS CLI With Wasabi
- Updated on 09 Apr 2024
- Print
- PDF
How do I use AWS CLI with Wasabi?
The AWS CLI (Command Line Interface) tool is certified for use with Wasabi. To use the AWS CLI with Wasabi, please following the config tips below. Note that this Article assumes you have the awscli tool already installed. To get info on how to install it, go to https://aws.amazon.com/cli/
Note that this example discusses the use of Wasabi's us-east-1 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article.
Configuring awscli using the configure
command
In order to access your wasabi buckets with the CLI you must utilize the configure
command.
Typing
$ aws configure
will bring up a series of prompts. Where it calls for access key and secret access key you will enter your Wasabi access key and your Wasabi secret key. For the region, type "us-east-1". Finally you can leave the last setting blank.
Note: If you follow options 2 or 3 below you will have to configure the [wasabi] profile after you create it.
to do so, simply type:
$ aws configure --profile wasabi
Using Wasabi with AWS CLI
There are three methods of utilizing wasabi with the CLI ranking from requiring the least amount configuration to most.
Option 1. Add the --endpoint-url
subcommand after every command
Adding the following after every command you make in the CLI (make sure to use the appropriate service URL as noted here; it may be different than s3.wasabisys.com
$ --endpoint-url=https://s3.wasabisys.com
Example:
if I want to list my buckets in the cli, I would type:
$ aws s3 ls --endpoint-url=https://s3.wasabisys.com
or, if i wanted to make a new bucket in the eu-central-1 region:
$ aws s3 mb s3://newbucketnamehere --endpoint-url=https://s3.eu-central-1.wasabisys.com
or, if I wanted to make a new bucket with OBJECT LOCK enabled in the us-central-1 region I would type:
$ aws s3api create-bucket --bucket yournewbucketnamehere --object-lock-enabled-for-bucket --endpoint-url=https://s3.us-central-1.wasabisys.com
It would look like this on the screen:
aws s3api create-bucket --bucket yournewbucketnamehere --object-lock-enabled-for-bucket --endpoint-url=https://s3.us-central-1.wasabisys.com
{
"Location": "/yournewbucketnamehere"
}
Option 2. using the awscli-plugin-endpoint
plugin
awscli-plugin-endpoint is a great plugin to help people more easily access third party S3 providers such as Wasabi.
Using the plugin requires you to create an additional profile in addition to the default one
Open the config
file in the .aws
Add a line profile line at the end of the config file like this at the end of the file:
[profile wasabi]
Then save the file.
Once you have a profile created, follow the instructions detailed on the plugin's git page located here:
https://github.com/wbinglee/awscli-plugin-endpoint
You should then be able to use --profile wasabi
after every command instead of typing out the entire url
Example:
if I want to list my buckets in the cli, I would type:
$ aws s3 ls --profile wasabi
Option 3. using export AWS_PROFILE
with awscli-plugin-endpoint
Once you have set up option 2, you can default the aws cli to point to the new profile at the beginning of your session. To do so follow the instructions below provided by AWS:
Linux, macOS, or Unix
$ export AWS_PROFILE=wasabi
Windows
> set AWS_PROFILE=wasabi
Setting the environment variable changes the default profile until the end of your shell session, or until you set the variable to a different value.
Example:
if I want to list my buckets in the cli, I would type:
$ aws s3 ls
Using AWS CLI for cloud-to-cloud migration scenarios:
Install AWS CLI and configure using your AWS Access Key and Secret Key. The instructions for the same can be found here.
Configure additional AWS CLI profile for Wasabi account using the Wasabi keys. You can refer to this article.
Transfer all files from the AWS bucket to local directory by running the following command:
aws s3 cp s3:/// --recursive
Then, transfer all files from the local directory to destination bucket at Wasabi:
aws s3 cp / s3:/// --recursive --profile wasabi
_____________________________________________________________________________________________________