How to create a s3 bucket and put objects in bucket through local pc using aws cli

Опубликовано: 16 Июнь 2026
на канале: Snehitha Bairi
38
0

Set Up AWS CLI:
Install the AWS Command Line Interface (CLI) on your computer and configure it with your AWS credentials using the command:

aws configure


Enter your Access Key ID, Secret Access Key, Default Region, and Output Format when prompted.

Create a New S3 Bucket:
Run the following command to create a new S3 bucket in your desired AWS region:

aws s3 mb s3://newadmin123 --region us-east-1


This creates a new bucket named newadmin123.
(Note: The bucket name must be globally unique across all AWS users.)

List All Buckets:
To verify that your bucket has been created successfully, run:

aws s3 ls


Upload a File from Local PC to S3:
You can upload a single file to your bucket using:

aws s3 cp C:\Users\YourName\Documents\example.txt s3://newadmin123/


This copies the local file example.txt to the S3 bucket.

Upload an Entire Folder:
To upload all files in a folder (recursively), use:

aws s3 cp "C:\Users\Bairi Snehitha\" s3://newadmin123/ --recursive


List Objects in the Bucket:
To see the files (objects) stored inside your S3 bucket, run:

aws s3 ls s3:/newadmin123/


Delete Files or the Bucket (Optional):

To delete a specific file:

aws s3 rm s3://newadmin123/example.txt


To delete the entire bucket and its contents:

aws s3 rb s3://newadmin123 --force