This post demonstrates how to create a folder on S3 from an EC2 instance.
How to Create Folder on S3 from EC2 Instance?
Before heading towards the instructions, it is required to create an EC2 instance. After that, follow these simple steps to learn how to create a folder on the S3 bucket from the EC2 instance.
Step 1: Connect to the Instance
Select the instance and click on the “Connect” button:
Copy the command from the “SSH client” section:
Paste the copied command to the terminal and change the path of the private key pair file:
Step 2: Download AWS CLI
Type the following command to download the AWS CLI file in the zipped format:
Unzip the AWS CLI file:
Step 3: Install AWS CLI
Install the AWS CLI on the instance:
Verify that the AWS Command Line Interface (CLI) has been installed on the system:
In our case, running the above command will display the “aws-cli/2.11.7” version:
Step 4: Configure AWS CLI
Configure the AWS CLI using IAM credentials from the AWS account:
To learn how to configure the AWS CLI, click here:
Use the following command to get the list of S3 buckets:
Step 5: Create a Folder on the S3 bucket
Following syntax can be used for creating a folder on the S3 bucket:
Change the [BucketName] and [FolderName] to the name of your S3 bucket and folder you want to create:
Running the above command will create a folder on the S3 bucket:
Step 6: Verify Folder Creation
Verify the folder creation on the S3 bucket by heading into the S3 dashboard and click on the “Buckets” page from the left panel:
Click on the bucket name:
It can be observed that inside the bucket, a folder has been created successfully:
That’s all about creating a folder on the S3 bucket from the EC2 instance.
Conclusion
To create a folder on the S3 bucket from the EC2 instance, create and connect to the EC2 instance. Download and install AWS CLI to use its commands on the EC2 instance. It is required to configure AWS CLI to use AWS CLI commands. After that, create a folder on the S3 bucket from the instance using the AWS CLI command. This guide has explained how to create a folder on S3 from an EC2 instance.