You can follow the instructions provided in the AWS CLI User Guide to install or update the latest version
Refer to AWS CLI User Guide: Configuration and credential file settings
scp
Replace
<obsAccessKey>
,<obsSecretKey>
aws configure set aws_access_key_id <obsAccessKey> --profile scp
aws configure set aws_secret_access_key <obsSecretKey> --profile scp
ubuntu@SCP:~$ aws configure list --profile scp
Name Value Type Location
---- ----- ---- --------
profile scp manual --profile
access_key ****************xxxx shared-credentials-file
secret_key ****************xxxx shared-credentials-file
region <not set> None None
To list the buckets, specify the API URL using the following command
Replace
<obsRestEndpoint>
aws s3 ls --endpoint-url <obsRestEndpoint> --profile scp
ubuntu@SCP:~$ aws s3 ls --endpoint-url https://xxxxxx:xxxx --profile scp
2023-05-05 12:34:56 bucket-scp
2023-05-08 18:27:36 bucket-sds
To use the scp
named profile for multiple commands without specifying it each time, you can set the AWS_PROFILE environment variable as the default profile
export AWS_PROFILE=scp
You can add the following code to your shell profile to include the --endpoint-url
option automatically when running AWS S3 commands
Replace
<obsRestEndpoint>
aws() {
if [ "$1" == "s3" ] || [ "$1" == "s3api" ] || [ "$1" == "s3control" ]; then
command aws --endpoint-url <obsRestEndpoint> "$@"
else
command aws "$@"
fi
}