Developing with Amazon S3 using the Amazon CLI
Follow these steps to download and configure Amazon Command Line Interface (Amazon CLI).
For a list of Amazon S3 Amazon CLI commands, see the following pages in the Amazon CLI Command Reference:
Note
Services in Amazon, such as Amazon S3, require that you provide credentials when you access them. The service can then determine whether you have permissions to access the resources that it owns. The console requires your password. You can create access keys for your Amazon Web Services account to access the Amazon CLI or API. However, we don't recommend that you access Amazon using the credentials for your Amazon Web Services account. Instead, we recommend that you use Amazon Identity and Access Management (IAM). Create an IAM user, add the user to an IAM group with administrative permissions, and then grant administrative permissions to the IAM user that you created. You can then access Amazon using a special URL and the credentials of that IAM user. For instructions, go to Creating Your First IAM user and Administrators Group in the IAM User Guide.
To set up the Amazon CLI
-
Download and configure the Amazon CLI. For instructions, see the following topics in the Amazon Command Line Interface User Guide:
-
Add a named profile for the administrator user in the Amazon CLI config file. You use this profile when executing the Amazon CLI commands. For more information, see Named profiles for the Amazon CLI in the Amazon Command Line Interface User Guide.
[adminuser] aws_access_key_id =
adminuser access key ID
aws_secret_access_key =adminuser secret access key
region =aws-region
For a list of available Amazon Web Services Regions, see Regions and Endpoints in the Amazon Web Services General Reference.
-
Verify the setup by typing the following commands at the command prompt.
-
Try the
help
command to verify that the Amazon CLI is installed on your computer:aws help
-
Run an
S3
command using theadminuser
credentials that you just created. To do this, add the--profile
parameter to your command to specify the profile name. In this example, thels
command lists buckets in your account. The Amazon CLI uses theadminuser
credentials to authenticate the request.aws s3 ls --profile adminuser
-