Skip to content

Instantly share code, notes, and snippets.

@MichaelCurrie
Last active March 25, 2021 12:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelCurrie/2dc46f71b7c579d141f6ceb1dc1c02ca to your computer and use it in GitHub Desktop.
Save MichaelCurrie/2dc46f71b7c579d141f6ceb1dc1c02ca to your computer and use it in GitHub Desktop.
Connecting your local machine to an S3 bucket

Connecting your local machine to an S3 bucket

Steps to get a file on your local machine uploaded to an AWS S3 bucket, and then downloaded and used in an AWS EC2 Ubuntu Instance. (In this case we do the reverse, but the process is similar)

STEP 1

Get security credentials to be able to use the AWS command line utility:

My access Key ID is at AWS console -> Michael Currie -> Security Credentials If you have saved the CSV file (rootkey.csv) downloaded from the Amazon console giving your Secret Access Key, enter it, otherwise create a new key and download the secret access key now.

https://stackoverflow.com/questions/21440709/how-do-i-get-aws-access-key-id-for-amazon Since we are accessing AWS from user accounts and not the root account we can't just do the above. Instead, go to top right drop down with your name -> Security Credentials -> Users -> Security Credentials -> Create Access Key (if you don't see this, you don't have sufficient privileges, and then ask @MichaelCurrie or another admin) Then you can create an access key and follow the steps in https://stackoverflow.com/questions/21440709/how-do-i-get-aws-access-key-id-for-amazon to get the information you need.

STEP 2 (From the terminal)

sudo apt-get install -y awscli
aws configure
# MANUAL: specify the data requested from the prompts

# Sync the contents of the source folder to the s3 bucket "michaeltest999"
cd ~/github/Lanki/bin
aws s3 sync . s3://michaeltest999

STEP 3

Then on your local machine, visit the AWS console, go to the s3 bucket michaeltest999 and download the file!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment