When I wanted to upload my media/audio/data files to my S3 Bucket, I was logging on to AWS through my web browser.
Yesterday, however, I learned a more efficient way to upload files to my S3 Bucket by using the AWS COMMAND LINE INTERFACE (AWS CLI). I installed and configured this onto my computer so that I would be able to upload files directly from my command window.
I created a user account with administrative permission using the AWS IAM service. I noticed a familiar thing happen. I received two sets of keys! That's right... a public key and a SECRET key. 😊This secret key works pretty much the same way the public and private keys work when using SSH. Just like the SSH keys, I filed the new keys from AWS IAM in a safe place on my computer.
Then I installed and configured AWS CLI onto my computer. Once it was installed, I gave it a test run... everything worked BUT---- all of the files I was putting into my S3 Bucket were not going in as public. So, I applied a bucket policy with this code:
{
"Id": "DefaultPublic",
"Statement": [
{
"Sid": "GetDefaultPublic",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::PUT THE NAME OF YOUR BUCKET HERE/*",
"Principal": {
"AWS": [
"*"
]
}
}
]
}
Once that was done...WHOLA! I was able to upload media, sound, and data files to my S3 Bucket from the command line and it ALL be visible to the public. I now have complete control to do everything that I need to do on the command line. 👊💪😆
Yesterday, however, I learned a more efficient way to upload files to my S3 Bucket by using the AWS COMMAND LINE INTERFACE (AWS CLI). I installed and configured this onto my computer so that I would be able to upload files directly from my command window.
I created a user account with administrative permission using the AWS IAM service. I noticed a familiar thing happen. I received two sets of keys! That's right... a public key and a SECRET key. 😊This secret key works pretty much the same way the public and private keys work when using SSH. Just like the SSH keys, I filed the new keys from AWS IAM in a safe place on my computer.
Then I installed and configured AWS CLI onto my computer. Once it was installed, I gave it a test run... everything worked BUT---- all of the files I was putting into my S3 Bucket were not going in as public. So, I applied a bucket policy with this code:
{
"Id": "DefaultPublic",
"Statement": [
{
"Sid": "GetDefaultPublic",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::PUT THE NAME OF YOUR BUCKET HERE/*",
"Principal": {
"AWS": [
"*"
]
}
}
]
}
Once that was done...WHOLA! I was able to upload media, sound, and data files to my S3 Bucket from the command line and it ALL be visible to the public. I now have complete control to do everything that I need to do on the command line. 👊💪😆
Follow me as I learn to build my website bit by bit! IronTreeDev.com
Photo by Andras Vas on Unsplash
Photo by Andras Vas on Unsplash
Yep, You a "power-user" now. Command line FTW! But since command line requires cumbersome typing, we will configuring your terminal window via .bash_profile to make the commands easier to execute and give you more power.
ReplyDeleteSounds good to me!
Delete