
You can use s3api putobject command to add an object to your bucket. Creating a Subdirectory and Uploading a Single File You’ve copied a single file to an existing bucket. ap-south-1 – actual region to which the file needs to be uploaded.–region – Region keyword to specify the region.s3://existing_bucket_name – Existing bucket name to which the file needs to be uploaded.file_to_upload.txt – File which needs to be uploaded.cp – Copy command to copy the file to the bucket.s3 – Denotes the service where the operation to be performed.
aws s3 cp file_to_upload.txt s3:// existing_bucket_name/ -region "ap-south-1" You can use the cp command to upload a file into your existing bucket as shown below. Uploading a Single File to an Existing Bucket
Create a subdirectory in the existing bucket and upload a file into it. In this section, you’ll upload a single file to the s3 bucket in two ways. Now, you’ll upload files to the created bucket. is mandatory at the end.Ī new subdirectory is created in your existing bucket. new_sub_directory_name/ – Name of your desired new object name. –key – keyword to specify the new key name. existing_bucket_name – Name of the existing bucket where you want to create a sub object. put-object – Put object command to put a new object inside an existing object. S3api – Denotes the service where the operation to be performed. aws s3api put-object -bucket existing_bucket_name -key new_sub_directory_name/ -region "ap-south-1" Use the S3API to create a new subdirectory inside your S3 bucket as given below. You’ll just create sub-objects inside your existing bucket. There are no such things called as folders in the S3 bucket. In this section, you’ll create a subfolder inside your existing S3 bucket. Now, you’ll create a subfolder in S3 Bucket. You’ve created a new bucket in your desired region. region – keyword to specify on which region the bucket needs to be created. S3://newbucketname – S3 URI, desired bucket name to be created. mb – Make bucket command to denote the make bucket operation. S3 – Denotes the service where the operation to be performed. aws s3 mb s3:// newbucketname -region " ap-south-1" Use the below command to make a new bucket in your s3.
S3 mb command in aws cli is used to make a bucket. In this section, you’ll create an S3 bucket that will logically group your files. Ensure you have installed and configured the AWS Cli using the guide How to Install and Configure AWS Cli on Ubuntu.In this tutorial, you’ll create an S3 bucket, create subfolders and upload files to AWS S3 bucket using the AWS CLI. All the files are stored as objects inside the containers called Buckets. Uploading All Files From a Directory to S3 BucketĪWS S3 is a Simple Storage Service used as an object storage service with high availability, security, and performance.