Uploading File To AWS S3 Using AWS CLI

Today, in this article, we are going to learn how to upload a file(s) or project to Amazon S3 using AWS CLI. To start with, first, we need to have an AWS account.

What is Amazon S3?

Amazon S3 stands for Amazon Simple Storage Service. It helps the developer community make computing scalable and more simple. Amazon S3 provides a platform where developers can store and download the data from anywhere and at any time on the web. Amazon S3 is a very fast and reliable storage infrastructure.

You can create a free AWS account or log into your account from here. Once you are logged into your AWS account, the next step is to create security credentials for your account, which includes an access key.

To get your credentials, follow the below steps.

1. Click Account name > My Security Credentials.

2. Select “Users” from the left panel.

3. Click on the username.

4. Now, from the screen shown below, you can set permissions and create your credentials by clicking on the “Create access key” button.

5. Copy your credentials or download the crendetials.csv to use later.

6. Download and install AWS CLI. You can install AWS CLI for any major operating system: macOSLinux, or Windows.

Here, we are using Windows OS so you can download the installer for Windows from here.

7. Once you successfully install the AWS CLI, open command prompt and execute the below commands.

  1. First, execute  aws configure to configure your account (This is a one-time process) and press Enter (this is a one-time process).
  2. Now, it will ask for an AWS access key ID, key, region name, and output format. Enter all the inputs and press Enter.

Your AWS account is configured with your workstation.

8. Now, it is time to create an S3 bucket.

1. To create a bucket, execute this command:

aws s3 mb s3://{YOUR-BUCKET-NAME}

See the example here: (aws s3 mb s3://my-first-csharp-bucket)

Check the AWS S3 account to see if your bucket is created.

9. Now, it’s time to upload the files.

To upload the files or project, execute the below command in CMD.

aws s3 sync "{YOUR-LOCAL-PATH}" s3://{YOUR-BUCKET-NAME}

10. If the path and bucket name is valid, then your files/project is successfully uploaded.


1 Comment

  1. Henrietta Moschella

    Bookmarked!, I like your blog!


Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories