Certifications / Microsoft

How to Create an S3 Bucket with PowerShell

How to Create an S3 Bucket with PowerShell picture: A
Follow us
Published on November 25, 2021

Sometimes it's just easier to work with AWS through a shell environment. The AWS web dashboard is fantastic for what it is, but it only takes a few seconds to create a new S3 bucket in PowerShell.

That process is significantly longer using the AWS web dashboard. Let's discuss how to create an S3 bucket with PowerShell, so you too can be a programming productivity guru.

An Overview of How to Create an S3 Bucket With PowerShell [VIDEO]

In this video, Trevor Sullivan covers how to create an Amazon S3 Bucket with AWS PowerShell. After outlining the steps you need to take to prep your Amazon Web Services account, he'll show you the commands you need to execute in PowerShell and explain where you can get more information if you need it.

How do I Install AWS Tools For PowerShell?

Before working with AWS through PowerShell, you need to complete a few steps first. Though PowerShell is a powerful shell environment, it doesn't know how to work with AWS out of the box. So, we need to install a few packages for PowerShell first.

The package that we need to install is the AWS Tools for PowerShell package. AWS Tools for PowerShell comes in one of two flavors:

  • Modular version

  • Bundle package

The modular version of AWS Tools for PowerShell lets you only install the tools that you need. So, for example, if your only intent is working with AWS S3, you only need the common tools and the tools for S3.

On the other hand, the bundle version includes all the AWS PowerShell applets. As a result, the bundle version of AWS Tools for PowerShell is easier to install, but it will consist of applets that you may not need.

For the sake of simplicity, let’s install the bundle version. There are a few different methods for installing AWS Tools for PowerShell. The first option is to download the package's zip file and install the applet manually. If you prefer installing AWS Tools for PowerShell manually, download the zip file from the AWS PowerShell documentation page.

The second method for installing AWS Tools for PowerShell is more straightforward. This method involves running a command through PowerShell itself to install the PowerShell Core from the PowerShell Gallery. That command is:

Set-AWSCredential 
         -AccessKey yourAccessKey
         -SecretKey yourSecretKey `
         -StoreAs MyNewProfile

Make sure to replace 'YourAccessKey,' 'yourSecretKey,' and 'MyNewProfile' with your actual AWS access key, secret key, and profile name, respectively.

After running that command, your AWS credentials will be stored in the AWS SDK under the profile name you chose.

You will need to reference that profile name with an AWS Tools for PowerShell applet, though. Referencing that profile name is easy enough. Use the '-ProfileName' parameter followed by your credentials profile name in any AWS applet command.

If you intend to be using those credentials a lot, you can set them as the default profile for AWS Tools for PowerShell. By doing this, you won't need to include that '-ProfileName' parameter with each command unless you want to use a different AWS credentials profile. Use the command below to set your default credentials profile in the AWS SDK in PowerShell:


Download

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.


Don't miss out!Get great content
delivered to your inbox.

By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.

Recommended Articles

Get CBT Nuggets IT training news and resources

I have read and understood the privacy policy and am able to consent to it.

© 2024 CBT Nuggets. All rights reserved.Terms | Privacy Policy | Accessibility | Sitemap | 2850 Crescent Avenue, Eugene, OR 97408 | 541-284-5522