2.4 Setting up Your First S3 Bucket
Introduction
Amazon Simple Storage Service (Amazon S3) is a scalable, high-speed, web-based cloud storage service designed for online backup and archiving of data and application programs. This guide will walk you through the process of setting up your first S3 bucket using both the AWS Management Console and AWS CLI (Command Line Interface).
Step 1: Sign in to the AWS Management Console
- If you don’t already have an AWS account, create one at the AWS homepage.
- Sign in to the AWS Management Console and navigate to the Amazon S3 service.
Step 2: Create a New Bucket
- In the S3 dashboard, click on “Create bucket.”
- Bucket Name: Choose a unique, DNS-compliant name for your bucket.
- Region: Select the AWS Region where you want the bucket to reside.
- Copy Settings from an Existing Bucket (Optional): If you wish to copy settings from an existing bucket, select one here.
Step 3: Configure Options
- Versioning: Enable versioning to keep multiple versions of an object in one bucket.
- Server Access Logging: Optional, for logging requests to your bucket.
- Tags: Add metadata to your bucket for easier management.
- Object-level Logging: Enable to log object-level operations.
- Default Encryption: Enable default encryption for added security.
- CloudWatch Request Metrics: Monitor your bucket by collecting data about requests.
Step 4: Set Permissions
- Block Public Access Settings: It’s recommended to block all public access unless you have a specific reason to allow it.
- Bucket Policy: Set a policy to manage permissions to your bucket.
- Access Control List (ACL): You can set ACLs for finer-grained permissions.
Step 5: Review and Create
- Review your bucket’s configuration and click “Create bucket.”
Using AWS CLI to Create a Bucket
If you prefer using command line, here’s how you can create a bucket using AWS CLI:
- Install and Configure AWS CLI:
- Install the AWS CLI from here.
- Configure it using
aws configure
and input yourAWS Access Key ID
,AWS Secret Access Key
, and preferred region.
- Create the Bucket:
- Use the command:
aws s3 mb s3://your-bucket-name --region your-region
3. Set Bucket Permissions (Block Public Access as an example):
- Use the command:
aws s3api put-public-access-block \
--bucket your-bucket-name \
--public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"