Intermediate 25 min

Step 1: Create the Storage Bucket

The storage bucket is where files will be uploaded. It’s also the source of events that trigger our function.

What is a Storage Bucket?

A bucket is a container for files. Think of it like a folder in the cloud:

  • You can upload files to it
  • Files have names and paths
  • You can organize files in folders
  • Access can be public or private

Bucket Properties

When creating a bucket, you’ll configure:

Region - Where the bucket is stored geographically

  • Choose a region close to you (lower latency)
  • Or close to your users (better performance)
  • Common choices: US East, EU West, Asia Pacific

Access Level - Who can access files

  • Private: Only you (and your functions) can access
  • Public: Anyone with the URL can access
  • For this tutorial: Keep it private

Naming - Bucket names must be unique globally

  • AWS S3: Globally unique across all AWS accounts
  • Azure: Unique within your subscription
  • GCP: Globally unique across all GCP projects

Create Bucket: AWS (S3)

Using AWS Console

  1. Go to AWS Console
  2. Navigate to S3 service
  3. Click Create bucket
  4. Enter bucket name (e.g., my-notifications-bucket-2025)
  5. Select region (e.g., us-east-1)
  6. Block Public Access: Keep enabled (private bucket)
  7. Click Create bucket

Using AWS CLI

# Install AWS CLI (if not installed)
# macOS: brew install awscli
# Linux: pip install awscli
# Windows: Download from aws.amazon.com/cli

# Configure credentials
aws configure

# Create bucket
aws s3 mb s3://my-notifications-bucket-2025 --region us-east-1

# Verify bucket created
aws s3 ls

Create Bucket: Azure (Blob Storage)

Using Azure Portal

  1. Go to Azure Portal
  2. Click Create a resourceStorage account
  3. Fill in details:
    • Subscription: Your subscription
    • Resource group: Create new or use existing
    • Storage account name: mynotifications2025 (lowercase, numbers only)
    • Region: Choose closest to you
    • Performance: Standard
    • Redundancy: LRS (Locally Redundant Storage)
  4. Click Review + createCreate

Create Container

After storage account is created:

  1. Go to your storage account
  2. Click Containers in left menu
  3. Click + Container
  4. Name: uploads
  5. Public access level: Private
  6. Click Create

Create Bucket: GCP (Cloud Storage)

Using GCP Console

  1. Go to GCP Console
  2. Navigate to Cloud StorageBuckets
  3. Click Create bucket
  4. Enter bucket name (e.g., my-notifications-bucket-2025)
  5. Choose location type: Region
  6. Select region (e.g., us-east1)
  7. Storage class: Standard
  8. Access control: Uniform
  9. Public access: Prevent public access
  10. Click Create

Bucket Structure (Optional)

You can organize files in folders:

bucket-name/
├── incoming/          # New uploads
├── processed/         # After processing
└── archive/           # Old files

For this tutorial, we’ll keep it simple and use the root of the bucket.

Verify Bucket Creation

Test that your bucket works:

# List buckets
aws s3 ls

# Upload a test file
echo "Hello, World!" > test.txt
aws s3 cp test.txt s3://my-notifications-bucket-2025/

# List files in bucket
aws s3 ls s3://my-notifications-bucket-2025/

# Delete test file
aws s3 rm s3://my-notifications-bucket-2025/test.txt

Important Settings

Keep It Private

For this tutorial, keep your bucket private:

  • Only you (and your functions) can access files
  • Prevents unauthorized access
  • More secure for real applications

Region Selection

Choose a region based on:

  • Your location: Lower latency for you
  • Your users: Better performance for them
  • Cost: Some regions are cheaper
  • Compliance: Some data must stay in specific regions

Naming Best Practices

Good bucket names:

  • my-notifications-bucket-2025
  • company-uploads-prod
  • project-name-storage

Avoid:

  • Generic names like bucket1 (might be taken)
  • Special characters (some providers don’t allow)
  • Uppercase letters (some providers require lowercase)

Checklist

Before moving to the next page:

  • Bucket created in your cloud provider
  • Region selected (note which one you chose)
  • Access level reviewed (should be private)
  • Bucket name saved (you’ll need it later)
  • Test upload successful (verified bucket works)

What’s Next?

Now that you have a storage bucket, let’s write the serverless function. In the next page, you’ll create code that receives events and processes file information.