Setting Up the Tools for the Example Walkthroughs
The introductory examples (see Example Walkthroughs: Managing Access to Your Amazon S3 Resources ) use the AWS Management Console to create resources and grant permissions. And to test permissions, the examples use the command line tools, AWS Command Line Interface (CLI) and AWS Tools for Windows PowerShell, so you don't need to write any code. To test permissions, you must set up one of these tools.
To set up the AWS CLI
Download and configure the AWS CLI. For instructions, see the following topics in the AWS Command Line Interface User Guide.
Set the default profile.
You will store user credentials in the AWS CLI config file. Create a default profile in the config file using your AWS account credentials.Copy
[default] aws_access_key_id =
access key IDaws_secret_access_key =
secret access keyregion = us-west-2
Verify the setup by entering the following command at the command prompt. Both these commands don't provide credentials explicitly, so the credentials of the default profile are used.
Try the help commandCopy
aws s3 lsto get a list of buckets on the configured account.Copy
aws s3 ls
As you go through the example walkthroughs, you will create users, and you will save user credentials in the config files by creating profiles, as the following example shows. Note that these profiles have names (AccountAadmin and AccountBadmin):
[profile AccountAadmin] aws_access_key_id =
User AccountAadmin access key IDaws_secret_access_key =
User AccountAadmin secret access keyregion = us-west-2 [profile AccountBadmin] aws_access_key_id =
Account B access key IDaws_secret_access_key =
Account B secret access keyregion = us-east-1
To execute a command using these user credentials, you add the
parameter specifying the profile name. The following AWS CLI command retrieves a listing
of objects in
examplebucket and specifies the
aws s3 ls s3://
Alternatively, you can configure one set of user credentials as the default profile by changing the
environment variable from the command prompt. Once you've done this, whenever you execute AWS CLI commands without the
parameter, the AWS CLI will use the profile you set in the environment variable as the default profile.
$ export AWS_DEFAULT_PROFILE=AccountAadmin
To set up AWS Tools for Windows PowerShell
Download and configure the AWS Tools for Windows PowerShell. For instructions, go to Download and Install the AWS Tools for Windows PowerShell in the AWS Tools for Windows PowerShell User Guide.
In order to load the AWS Tools for Windows PowerShell module, you need to enable PowerShell script execution. For more information, go to Enable Script Execution in the AWS Tools for Windows PowerShell User Guide.
For these exercises, you will specify AWS credentials per session using the
Set-AWSCredentialscommand. The command saves the credentials to a persistent store (
Verify the setup.
Get-Commandto retrieve a list of available commands you can use for Amazon S3 operations.Copy
Get-Command -module awspowershell -noun s3* -StoredCredentials
Get-S3Objectcommand to retrieve a list of objects in a bucket.Copy
For a list of commands, go to Amazon Simple Storage Service Cmdlets.
Now you are ready to try the exercises. Follow the links provided at the beginning of the section.