Let’s Start with how to upload files to S3 using AWS CLI:
Upload Files to S3 Using AWS CLI
To upload files to an AWS S3 bucket using the AWS CLI, simply search the “CMD” in the windows search bar and click on the “Run as administrator” button to open the command prompt:
On the command prompt simply configure the AWS CLI using the following command:
In the configuration, it will prompt you to enter the Access and Secret keys for the IAM user and then you need to enter the region and format name:
Once the AWS is configured type the following command to check the list of S3 buckets:
Running the above command will display the following output:
Then select any bucket in which you want to upload the files and check if there are files available in the bucket by using the following command:
This command will display the list of all files in the bucket. In this case, we don’t have any file in the upload311 bucket so it doesn’t show anything:
The following command is used to upload files in the S3 bucket:
This command will upload the file “myapp.html” in the bucket “upload311”:
To check the list of files uploaded simply use the following command:
This command will display the list of files in the S3 bucket:
You have successfully uploaded files in the S3 bucket using AWS CLI:
Conclusion
To upload a file in the AWS S3 bucket simply open the Command Prompt or PowerShell and configure AWS. After the configuration, simply look for the buckets available in which you want to upload the file and use simple commands to upload files in the S3 bucket and check the list of the uploaded files in the S3 bucket.