Developing with Amazon S3 using the AWS CLI - Amazon Simple Storage Service

Developing with Amazon S3 using the AWS CLI

Follow these steps to download and configure AWS Command Line Interface (AWS CLI).

For a list of Amazon S3 AWS CLI commands, see the following pages in the AWS CLI Command Reference:


Services in AWS, 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 AWS account to access the AWS CLI or API. However, we don't recommend that you access AWS using the credentials for your AWS account. Instead, we recommend that you use AWS 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 AWS 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 AWS CLI
  1. Download and configure the AWS CLI. For instructions, see the following topics in the AWS Command Line Interface User Guide:

  2. Add a named profile for the administrator user in the AWS CLI config file. You use this profile when executing the AWS CLI commands. For more information, see Named profiles for the AWS CLI in the AWS 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 AWS Regions, see Regions and Endpoints in the AWS General Reference.

  3. Verify the setup by typing the following commands at the command prompt.

    • Try the help command to verify that the AWS CLI is installed on your computer:

      aws help
    • Run an S3 command using the adminuser credentials that you just created. To do this, add the --profile parameter to your command to specify the profile name. In this example, the ls command lists buckets in your account. The AWS CLI uses the adminuser credentials to authenticate the request.

      aws s3 ls --profile adminuser