Step-by-step guide to get your WordPress on LightSail fully running with a static IP, Route 53 DNS, and the launch script with dynamic salts

📍 Introduction

The AWS Command Line Interface (CLI) allows you to manage your AWS resources efficiently without logging into the web console. In this tutorial, you’ll learn how to create and manage Amazon S3 buckets using AWS CLI commands.

🪜 Step 1: Install AWS CLI

Install AWS CLI on your system using the commands below:

🐧 Linux / Ubuntu:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

🍎 macOS:

brew install awscli

To verify:

aws --version

Step 2: Configure AWS CLI

Use the following command and enter your AWS credentials:

aws configure

You’ll be asked to enter:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Region (e.g., us-east-1)
  • Output format (json or table)

🪜 Step 3: Create a New S3 Bucket

aws s3 mb s3://my-blog-bucket --region us-east-1

This command creates a new bucket named my-blog-bucket.


🪜 Step 4: Upload Files to S3

aws s3 cp index.html s3://my-blog-bucket/

To sync an entire folder:

aws s3 sync ./site s3://my-blog-bucket/

🪜 Step 5: List All Buckets

aws s3 ls

🪜 Step 6: Make Files Public (Static Hosting)

Update your bucket policy:

jsonCopyEdit{
  "Version":"2012-10-17",
  "Statement":[{
    "Effect":"Allow",
    "Principal": "*",
    "Action":["s3:GetObject"],
    "Resource":["arn:aws:s3:::my-blog-bucket/*"]
  }]
}

Upload it using:

aws s3api put-bucket-policy --bucket my-blog-bucket --policy file://policy.json

✅ Summary

You’ve now learned how to:

  • Install and configure AWS CLI
  • Create S3 buckets
  • Upload and sync files
  • Set public access for static hosting


Scroll to Top