DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Rapid AWS Prototyping With LocalStack: A Developer’s Guide to Building AWS PoCs Locally
  • Building a Serverless Application on AWS With AWS SAM
  • Terraform Best Practices: The 24 Practices You Should Adopt
  • Keep Your Application Secrets Secret

Trending

  • Introduction to Retrieval Augmented Generation (RAG)
  • How to Set Up and Run PostgreSQL Change Data Capture
  • Throughput vs Goodput: The Performance Metric You Are Probably Ignoring in LLM Testing
  • Key Takeaways From Integrating a RAG Application With LangSmith
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Uploading File To AWS S3 Using AWS CLI

Uploading File To AWS S3 Using AWS CLI

Take a look at the first steps to using AWS S3 with this tutorial on uploading your files with the native CLI.

By 
Faisal Pathan user avatar
Faisal Pathan
·
Mar. 19, 19 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
29.2K Views

Join the DZone community and get the full member experience.

Join For Free

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.
Uploading File To AWS S3 Using AWS CLI


2. Select "Users" from the left panel.
Uploading File To AWS S3 Using AWS CLI


3. Click on the username.

Uploading File To AWS S3 Using AWS CLI


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


Uploading File To AWS S3 Using AWS CLI


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

Uploading File To AWS S3 Using AWS CLI


6. Download and install AWS CLI. You can install AWS CLI for any major operating system: macOS, Linux, 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.

Uploading File To AWS S3 Using AWS CLI

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)
Uploading File To AWS S3 Using AWS CLI


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

Uploading File To AWS S3 Using AWS CLI

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}


Uploading File To AWS S3 Using AWS CLI




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

Uploading File To AWS S3 Using AWS CLI




Output

Uploading File To AWS S3 Using AWS CLI

AWS Command-line interface

Opinions expressed by DZone contributors are their own.

Related

  • Rapid AWS Prototyping With LocalStack: A Developer’s Guide to Building AWS PoCs Locally
  • Building a Serverless Application on AWS With AWS SAM
  • Terraform Best Practices: The 24 Practices You Should Adopt
  • Keep Your Application Secrets Secret

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook