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 Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  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.

Faisal Pathan user avatar by
Faisal Pathan
·
Mar. 19, 19 · Tutorial
Like (2)
Save
Tweet
Share
27.96K 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.

Popular on DZone

  • Tackling the Top 5 Kubernetes Debugging Challenges
  • Cloud Performance Engineering
  • Choosing the Right Framework for Your Project
  • Configure Kubernetes Health Checks

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: