Online courses covering AWS Associate certifications typically teach how to access the AWS CLI using Puttygen and Putty, the Connect option in EC2, or CloudShell. However, they usually don’t explain how to upload local files to AWS services like S3 and DynamoDB. In this guide, I’ll explain a few different ways to do this. They will require the installation of the AWS CLI.

How to Access the AWS CLI


Installing the AWS CLI is taught in beginner courses, so I won’t explain that here. Once you have installed it, you can access the CLI directly from your Windows machine in a few different ways. Go to the Search box in the bottom left-hand corner of Windows labeled Type here to search, and:

type cmd to open the Command Prompt, or, type powershell to open Windows Powershell

If you choose PowerShell, you can use many Linux commands. If you choose the Command Prompt, you may find it helpful to learn Windows equivalents of common Linux commands.

Windows Subsystem for Linux (WSL):

Another option is to use the Windows Subsystem for Linux (WSL) and choose a distribution. I use the Ubuntu distribution. Go to the Microsoft Store, and search for Windows Subsystem for Linux to see the available options. When it’s installed, go to the search box in the bottom left-hand corner of Windows and type the required command to run it. For example, if you install Ubuntu, type ubuntu into the search. You will have to install the AWS CLI on this Linux distribution to access AWS. Your C: drive should be mounted at /mnt/c so your Windows user account files should be located at /mnt/c/Users/.

Windows and Linux Equivalent Commands

If you want to use the Command Prompt, you will have to use Linux commands for AWS commands but Windows equivalents for commands on your local system. For example, if you want a list of objects in an S3 bucket called mybucket, you will use the Linux ls command: If you want to list all the items in your local Windows Documents folder, you have to use the Windows command dir: Of course, you could just go to the Documents folder to see all the objects it contains. But that’s more time-consuming than accessing that information within the command line itself. Both Windows and Linux commands can be used with Windows PowerShell.

Windows Equivalents for Common Linux Commands

To create files in Linux, use the touch or echo commands. To create files in Windows, use the echo command. echo “This is some text” > file1.txt Text can be entered into a file during file creation by placing it before the > symbol.

Create a Dedicated Folder for Lab Uploads

The easiest way to upload lab files is to have a dedicated folder on your hard drive for that purpose. In my Documents folder, I have a subfolder called Learn. I download the lab files I need to upload to AWS into this Learn folder. Before uploading files, you need to navigate to that folder in whatever command-line tool you are using. Type the following commands:

Command Prompt and PowerShell

This will take you to the c:> prompt. This is the command I type to navigate to the Learn folder. Figure out the path to whatever folder you are using, then use the cd (change directory) command to navigate to it.

Windows Subsystem for Linux (WSL)

When using the Windows Subsystem for Linux, this is my path to the Learn folder.

Upload Files to AWS S3 and DynamoDB

Once you have installed the AWS CLI, you can access AWS using your Access Key ID and Secret Access Key. To log in, go to either the Command Prompt, Windows PowerShell, or the Windows Subsystem for Linux, and type this command: When prompted, enter your Access Key ID and Secret Access Key. If you will be working within a particular region, you will be prompted to enter it. For example, enter us-east-1 if you will be working in the Northern Virginia region, ap-southeast-1 for the Singapore region, eu-west-1 for the Ireland region, and so on. These are some useful commands for working with S3 buckets and uploading objects.

S3 Commands

To see a list of S3 buckets in your account: To list all the objects in a particular bucket: To upload an object called mypic.png to a bucket: To upload a folder called mysynctest, use this command: To see the files in the uploaded folder: (–recursive copies the directory and everything in it) To sync a folder called mysynctest on your hard drive to a subdirectory in s3 called mysynctest, use this command:

DynamoDB Upload Command

This command can be used to upload a JSON file called myfile.json to DynamoDB: This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters. © 2021 LT Wright

How to Upload Local Files to AWS S3 and DynamoDB - 47How to Upload Local Files to AWS S3 and DynamoDB - 34How to Upload Local Files to AWS S3 and DynamoDB - 72How to Upload Local Files to AWS S3 and DynamoDB - 26