AWS
AWS Lightsail Docker Volume
Summary
This guide shows you how to attach an AWS Lightsail block storage disk to an Ubuntu instance, format and mount it at /data, and configure Docker so its named volumes live on that disk. This keeps your WordPress and database data on the larger block storage volume and ensures it persists across reboots (and can survive instance rebuilds if you reattach the disk).
1. Confirm your Region and Availability Zone
Before you create the disk, you need the instance’s Availability Zone (AZ). The AWS Lightsail create-disk command won’t work unless you provide –availability-zone.
lightsail-instance-config.json: Get the Availability Zone from thelightsail-instance-config.jsonfile created in Lightsail Instance for DockerAWS CLI (pull the AZ directly from Lightsail):
aws lightsail get-instances --query "instances[?name=='MyUbuntuInstance'].location.availabilityZone | [0]" --output text --profile MyUbuntuProfile
Options explained
aws lightsail get-instancesThis command tells the AWS CLI to return details for all instances in the account/region tied to the selected profile.--query "instances[?name=='MyUbuntuInstance'].location.availabilityZone | [0]"AWS CLI User Guide – Filtering output with –query.--output textPrints the result as plain text.--profile MyUbuntuProfileSelects which AWS CLI profile to use. This is helpful if you have multiple accounts or credentials configured.
2. Create the Lightsail disk
Create a new Lightsail block storage disk using the aws lightsail aws lightsail create-disk command, and provisioning in the same Availability Zone as your existing instance.
aws lightsail create-disk --disk-name MyUbuntuProfile-Docker-Volume-1 --region ap-southeast-2a --size-in-gb 32 --profile MyUbuntuProfile
Options explained
aws lightsail create-diskThis command tells the AWS CLI to create a new block storage disk.--disk-name MyUbuntuProfile-Docker-Volume-1Choose a unique and descriptive name for the disk in your Lightsail account.--region ap-southeast-2aDespite the flag name, Lightsail expects the AZ for block storage here (e.g., ap-southeast-2a).--size-in-gb 32Disk size. You choose based on WordPress + DB growth, uploads, backups, etc.--profile MyUbuntuProfileSelects which AWS CLI profile to use. This is helpful if you have multiple accounts or credentials configured.
3. Attach the disk to your instance
Now that the disk is created MyUbuntuProfile-Docker-Volume-1, attach it to the instance MyUbuntuInstance so Ubuntu can detect it as a new drive.
aws lightsail attach-disk --disk-name MyUbuntuProfile-Docker-Volume-1 --disk-path /dev/xvdf --instance-name MyUbuntuInstance --profile MyUbuntuProfile
Options explained
aws lightsail attach-diskThis command tells the AWS CLI to attach a block storage disk to an instance.--disk-name MyUbuntuProfile-Docker-Volume-1The name of the Lightsail disk you created earlier. This must match exactly.--disk-path /dev/xvdfDevice name Ubuntu will see for the newly attached disk in Ubuntu instance. This is the attachment path; in Ubuntu, it may appear as /dev/xvdf or sometimes /dev/nvme, depending on the virtualization.--instance-name MyUbuntuInstanceInstance name you’re attaching the disk to.--profile MyUbuntuProfileSelects which AWS CLI profile to use. This is helpful if you have multiple accounts or credentials configured.
4. Verify attachment
Now let’s confirm the command returns a quick status summary for the Lightsail block storage disk.
aws lightsail get-disk --disk-name MyUbuntuProfile-Docker-Volume-1 --query 'disk.{name:name,state:state,attachedTo:attachedTo,path:path,isAttached:isAttached}' --output table --profile MyUbuntuProfile
Options explained
aws lightsail get-diskThis command tells the AWS CLI to retrieve details about one block storage disk.--disk-name MyUbuntuProfile-Docker-Volume-1Which disk to look up in Lightsail disk resource.--query 'disk.{name:name,state:state,attachedTo:attachedTo,path:path,isAttached:isAttached}'Using aJMESPathquery extracting from the top-level disk object.--output tableRender the result as a human-readable ASCII table – Setting the output format in the AWS CLI--profile MyUbuntuProfileSelects which AWS CLI profile to use. This is helpful if you have multiple accounts or credentials configured.
Output
-----------------------------------------------------------------
| GetDisk |
+------------+--------------------------------------------------+
| attachedTo| MyUbuntuProfile-Docker-Volume-1-docker-1 |
| isAttached| True |
| name | MyUbuntuProfile-Docker-Volume-1 |
| path | /dev/xvdf |
| state | in-use |
+------------+--------------------------------------------------+
5. Connect to the Ubuntu instance via SSH
Next, connect to the Lightsail instance via SSH so we can format and mount the disk on the Ubuntu server.
ssh MyUbuntuInstance
6. Identify the new disk in the Ubuntu Instance
Next, we need to identify the disk that will be mounted on the system.
sudo lsblk
Options explained
sudoRun the command with administrator privileges.lsblkRun the command to display all disks, partitions, and mount points currently available on the Ubuntu server.
Output
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme1n1 259:5 0 32G 0 disk
7. Create a filesystem on the new disk (only if empty)
Next we need to format the disk /dev/nvme1n1 with the XFS filesystem.
sudo mkfs -t xfs /dev/nvme1n1
Options explained
sudoRun the Linux command with administrator privileges.mkfsIs the Linux commandmake filesystem, create a new filesystem on the target disk.-t xfsCreate the disk using the XFS filesystem type./dev/nvme1n1Disk device being formatted.
Output
meta-data=/dev/nvme1n1 isize=512 agcount=16, agsize=524288 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=1 bigtime=1 inobtcount=1 nrext64=0
data = bsize=4096 blocks=8388608, imaxpct=25
= sunit=1 swidth=1 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
8. Create a mount point (folder) and mount the disk
First, create a folder that will be used as the disk’s mount location.
sudo mkdir -p /data
Next, mount the disk to that folder.
sudo mount /dev/nvme1n1 /data
Options explained
sudoRun the command with administrator privileges.mountIs the Linux command used to attach a storage device to the filesystem./dev/nvme1n1is the block device representing the disk that was identified./dataThis is the folder where the disk will be accessible and mounted.
Finally, confirm that the disk is mounted successfully using df utility command.
df -h | grep /data
Options explained
dfShows disk usage and mounted filesystems.-hDisplays sizes in GB, MB, etc.grep /dataFilters the output to show only the/datamount.
This mount is temporary and will disappear after a reboot. In the next step, the disk will be added to /etc/fstab so it automatically mounts when the server starts.
9. Persist the mount using /etc/fstab on reboot
Before modifying the filesystem table, it is recommended to create a backup of the file. If an error is introduced while editing /etc/fstab, the system may fail to mount disks correctly during startup.
sudo cp /etc/fstab /etc/fstab.orig
We need to use the UUID (Universally Unique Identifier) of the disk instead of the device name.
This is more reliable because device names like /dev/nvme1n1 can sometimes change after reboot.
sudo blkid /dev/nvme1n1
Options explained
sudoRun the command with administrator privileges.blkidUtility command that shows block device attributes, such as UUID , filesystem type and label./dev/nvme1n1Block device representing the disk.
Output
/dev/nvme1n1: UUID="92a4a81e-d66f-420e-9f7a-234cbb5c681e" BLOCK_SIZE="512" TYPE="xfs"
Open the filesystem table configuration file, this file controls which disks are mounted automatically when the system boots.
sudo nano /etc/fstab
Add the following line to the bottom of the file, please tab.
UUID=92a4a81e-d66f-420e-9f7a-234cbb5c681e /data xfs defaults,nofail 0 2
Options explained
UUID=92a4a81e-d66f-420e-9f7a-234cbb5c681eUnique identifier for the disk./dataFolder where the disk will be mounted and made accessible.xfsFilesystem type used when the disk was formatted.defaults,nofailStandard mount options. nofail prevents boot errors if the disk is missing.0Dump backup option, which is typically set to 0 to disable filesystem backups.2Order for filesystem checks during boot.
10. Reboot test
Restart the server to confirm the disk mounted /data automatically.
sudo reboot
Next, reconnect to the Lightsail instance via SSH.
ssh MyUbuntuInstance
Finally, run the df command to confirm the disk is mounted successfully.
df -h | grep /data
Output
/dev/nvme1n1 32G 660M 32G 3% /data
11. Adding Docker Volume
We need to ensure Docker starts after /data is mounted. it is important that /data is available before Docker starts.
If Docker starts before /data is mounted during system boot, it may create empty directories under /data. This can cause containers to start with missing or incorrect data.
To prevent this issue, add a dependency so Docker waits until /data is mounted before starting.
Connect to the Lightsail instance via SSH.
ssh MyUbuntuInstance
Create a systemd override for Docker, this opens a small override file.
sudo systemctl edit docker
Add the dependency. This tells systemd that Docker must wait until the /data mount is available before starting.
[Unit]
RequiresMountsFor=/data
Reload systemd and restart Docker or reboot.
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl restart docker
Or.
sudo reboot
12. Preparing Docker Volumes for WordPress for Lightsail
Create the folders under /data that will hold the persistent data for the WordPress files and MySQL database. Docker will later bind the named volumes to these locations.
Create the folders on /data that will hold the Docker volume data.
sudo mkdir -p /data/volumes/wp_html
sudo mkdir -p /data/volumes/mysql
Create named Docker volumes backed by those folders on /data.
docker -H ssh://MyUbuntuInstance volume create wp_html --driver local --opt type=none --opt device=/data/volumes/wp_html --opt o=bind
docker -H ssh://MyUbuntuInstance volume create mysql_data --driver local --opt type=none --opt device=/data/volumes/mysql --opt o=bind
Options explained
docker volumecreate creates a new Docker volume, wp_html and mysql_data are the names of the volumes.--driverlocal tells Docker to use the local volume driver.--opt type=noneis used when creating a bind-backed volume.--opt device=...points Docker to the folder on your machine.--opt o=bindtells Docker to bind that folder into the volume.
Verify Volumes
Check that Docker is using your local folders.
docker -H ssh://MyUbuntuInstance volume inspect wp_html
Output
Docker will return JSON output describing each volume.
[
{
"CreatedAt": "2025-12-16T11:14:48Z",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/wp_html/_data",
"Name": "wp_html",
"Options": {
"device": "/data/volumes/wp_html",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
docker volume inspect mysql_data
Output
[
{
"CreatedAt": "2025-12-16T11:16:01Z",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/mysql_data/_data",
"Name": "mysql_data",
"Options": {
"device": "/data/volumes/mysql",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
Further Reading
- Create and attach Lightsail block storage disks to Ubuntu instances
- Expand storage and performance with Lightsail block storage disks
- AWS CLI – create-disk
- Regions and Availability Zones for Lightsail
- JMESPath is a query language for JSON
- Introduction to fstab
Using WordPress on AWS Lightsail and Docker
Docker Desktop volumes for WordPress
Summary
1. Create Local Folders for Data
Choose a location on your computer where Docker will store persistent WordPress and MySQL data.
Windows
mkdir C:\docker-data\wp_html
mkdir C:\docker-data\mysql
Output
- C:\docker-data\wp_html for WordPress files
- C:\docker-data\mysql for MySQL database files
macOS / Linux
mkdir -p ~/docker-data/wp_html
mkdir -p ~/docker-data/mysql
Output
- ~/docker-data/wp_html for WordPress files
- ~/docker-data/mysql for MySQL database files
2. Create Bind-Backed Docker Volumes
Create named Docker volumes that bind to the local folders you created earlier. This allows Docker to store WordPress and database data in those folders instead of inside Docker’s default internal storage.
Windows
docker volume create wp_html --driver local --opt type=none --opt device=C:\docker-data\wp_html --opt o=bind
docker volume create mysql_data --driver local --opt type=none --opt device=C:\docker-data\mysql --opt o=bind
macOS / Linux
docker volume create wp_html --driver local --opt type=none --opt device=$HOME/docker-data/wp_html --opt o=bind
docker volume create mysql_data --driver local --opt type=none --opt device=$HOME/docker-data/mysql_data --opt o=bind
Options explained
docker volumecreates a new Docker volume. In this example, wp_html and mysql_data are the names of the volumes being created.--driverlocal tells Docker to use the local volume driver.--opt type=noneis used when creating a bind-backed volume.--opt device=...tells Docker which folder on your machine should be used for the volume.--opt o=bindtells Docker to bind that folder into the volume.
3. Verify the Docker Volumes
Check that Docker is using the local folders you mapped.
docker volume inspect wp_html
Output
Docker will return JSON describing the volume configuration.
[
{
"CreatedAt": "2026-03-17T12:01:21Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/wp_html/_data",
"Name": "wp_html",
"Options": {
"device": "C:\\docker-data\\wp_html",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
docker volume inspect mysql_data
Output
[
{
"CreatedAt": "2026-03-17T12:00:51Z",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/mysql_data/_data",
"Name": "mysql_data",
"Options": {
"device": "C:\\docker-data\\mysql",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
4. Start Your Containers Using the Volumes
After the volumes have been created, they can be attached to your WordPress and database containers. When the containers use wp_html and mysql_data, Docker stores the data in the local folders you configured earlier rather than in Docker’s default internal storage.
A typical setup maps
wp_html -> /var/www/html
mysql_data -> /var/lib/mysql
You can then start your containers with Docker Compose, depending on how your project is structured. Because the data is stored outside the containers, it remains available even if the containers are stopped, removed, or recreated.
This gives you a straightforward Docker Desktop development setup with persistent storage. WordPress files remain available between container restarts, MySQL data is retained even if containers are rebuilt, and the files stay accessible from the host machine. Another advantage is that no manual disk formatting or mounting is required.
Because this approach works across Windows, macOS, and Linux with Docker Desktop, it is well suited to local WordPress development, plugin testing, theme experimentation, or preparing an application before deploying it to a cloud server.
Further Reading
Using WordPress on AWS Lightsail and Docker
AWS Lightsail Instance for Docker
Summary
This chapter guides you through setting up an Ubuntu Lightsail instance pre-configured for Docker, enabling you to deploy and manage containers like WordPress and MySQL Server quickly.
You’ll learn how to:
- Generate and secure a custom SSH key pair to access the instance.
- Use AWS CLI commands and configuration files to launch your Lightsail instance.
- Apply a user-data script to automatically install Docker, Docker Compose, and supporting tools during creation.
- Assign and attach a static IP address for reliable access.
- Connect via SSH and verify your environment.
- Clean up resources when they’re no longer needed.
By the end of this chapter, you’ll have a fully operational AWS Lightsail instance ready to run Docker containers for WordPress, MySQL and other applications in a secure and repeatable way.
Create a Custom SSH Key Pair
Before running ‘aws lightsail create-instances’, you need an SSH key pair so the AWS account can associate it with the new instance. The key pair provides the secure SSH credentials required to connect to the instance after it is created. If you skip this step, you won’t have a valid .pem file to authenticate with your server. By creating the key pair first, you ensure that when you launch the instance, it can be accessed securely using your private key immediately.
Create a directory (e.g., MyUbuntuInstance).
1. Create the SSH key pair
Run this in PowerShell (Windows) or bash (Linux/macOS):
aws lightsail create-key-pair --region ap-southeast-2 --key-pair-name MyUbuntuInstanceKeyPair --query privateKeyBase64 --output text > MyUbuntuInstanceKeyPair.pem --profile MyUbuntuProfile
Options explained:
aws lightsail create-key-pairThis command tells the AWS Cli to create a new Lightsail SSH key pair.--region ap-southeast-2Specifies the AWS region (Sydney). If you don’t set this, the AWS Cli defaults to whatever is configured in your AWS profile.--key-pair-name MyUbuntuInstanceKeyPairThe name you’re giving to the new key pair in Lightsail. You’ll use this name later when creating an instance with –key-pair-name.--query privateKeyBase64Filters the command’s JSON output so that only the private key (in base64-encoded text) is returned, not the whole JSON response.--output textEnsures the result is output as plain text instead of JSON. Without this, you’d get JSON formatting that isn’t usable as a .pem file.> MyUbuntuInstanceKeyPair.pemRedirects the output (the private key) into a file called MyUbuntuInstanceKeyPair.pem. This file is what you’ll use with SSH.--profile MyUbuntuProfileSelects which AWS CLI profile to use. This is helpful if you have multiple accounts or credentials configured.
2. Fix permissions
SSH requires that your .pem file is locked down. SSH refuses to use a .pem file if it’s too “open” (i.e., readable by other users). Locking it down ensures only you can read it.
Linux/macOS:
chmod 600 MyUbuntuInstanceKeyPair.pem
Options explained:
chmod– Change file mode (permissions).600– Sets permissions so that:- Owner: Read and Write
- Group: No permissions
- Others: No permissions
Windows PowerShell:
icacls.exe MyUbuntuInstanceKeyPair.pem /inheritance:r
Options explained:
icacls.exeA Windows command-line tool used to view or modify file and folder access control lists (ACLs).MyUbuntuInstanceKeyPair.pemTarget file./inheritance:rRemoves inherited permissions (so the file doesn’t inherit broad access rights from the folder).
icacls.exe MyUbuntuInstanceKeyPair.pem /grant:r "$($env:USERNAME):(R)"
/grant:rGrants permissions, replacing any existing ones."$($env:USERNAME)"Expands to your current Windows username.:(R)Read-only permission.
3. List SSH Key pair names
aws lightsail get-key-pairs --region ap-southeast-2 --query "keyPairs[].name" --output text --profile MyUbuntuProfile
4. Deleting an SSH Key Pair
If you no longer need the key, delete both to keep your system and AWS environment tidy.
1. Delete the local .pem file
Linux/macOS:
rm MyUbuntuInstanceKeyPair.pem
Windows PowerShell:
icacls "MyUbuntuInstanceKeyPair.pem" /inheritance:e
/inheritance:ere-enables permission inheritance from the parent folder.- This means the file will now take on the normal ACLs (Access Control Lists) from its directory again, instead of being locked to just the user.
icacls "MyUbuntuInstanceKeyPair.pem" /reset
/resetwipes any custom permissions on the file.- After this, only the default inherited permissions apply (e.g. Administrators, your user, System). This step ensures you (and Windows) can manage or delete the file normally.
Remove-Item "MyUbuntuInstanceKeyPair.pem" -Force
Remove-Itemdeletes the file.-Forcebypasses prompts and ignores hidden/system attributes if set.- Now that inheritance is restored and ACLs are reset, Windows lets you remove the file without Access Denied errors.
2. Delete the SSH key pair from AWS Lightsail
First, check which key pairs exist in your region:
aws lightsail get-key-pairs --region ap-southeast-2 --query "keyPairs[].name" --output text --profile MyUbuntuProfile
Then delete the one you no longer need:
aws lightsail delete-key-pair --key-pair-name MyUbuntuInstanceKeyPair --region ap-southeast-2 --profile MyUbuntuProfile
Creating a Lightsail Instance
aws lightsail create-instances --cli-input-json file://lightsail-instance-config.json --user-data file://userdata.bash --profile MyUbuntuProfile
1. Create the Configuration File
Create a new file named lightsail-instance-config.json and add:
{
"instanceNames": ["MyUbuntuInstance"],
"availabilityZone": "ap-southeast-2a",
"blueprintId": "ubuntu_24_04",
"bundleId": "small_3_2",
"userData": "",
"keyPairName": "MyUbuntuInstanceKeyPair",
"tags": [
{
"key": "Docker",
"value": "WordPress-Docker"
}
]
}
2. Create external user-data file
Create a new file named userdata.bash and add:
#!/bin/bash
LOGFILE="/var/log/userdata.log"
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $*" >> "$LOGFILE"
}
log "Start user-data script"
log "sudo apt-get update -y"
sudo apt-get update -y
log "apt-get install -y libarchive-tools"
sudo apt-get install -y libarchive-tools
log "apt install -y zip"
sudo apt install -y zip
log "Install BashNovusTools"
sudo mkdir -p /etc/bashnovustools && curl -L https://github.com/novuslogic/BashNovusTools/releases/download/v0.1.3/BashNovusTools.v0.1.3.zip -o /tmp/bashnovustools.zip && sudo bsdtar -xf /tmp/bashnovustools.zip -C /etc/bashnovustools && sudo chmod +x /etc/bashnovustools/bin/*.sh && echo 'export PATH=\"/etc/bashnovustools/bin:$PATH\"' | sudo tee /etc/profile.d/bashnovustools.sh
# Update Ubuntu to latest packages
log "Update Ubuntu to latest packages"
sudo /etc/bashnovustools/bin/update-ubuntu.sh
# Install Docker Engine
log "Install Docker Engine"
sudo /etc/bashnovustools/bin/install-docker-engine.sh
# Install Docker Compose
log "Install Docker Compose"
sudo /etc/bashnovustools/bin/install-docker-compose.sh
# Add ubuntu user to docker group (will take effect on next login)
log "Add ubuntu user to docker group"
sudo /usr/sbin/usermod -aG docker ubuntu || true
log "End user-data script"
Create a static IP
1. Pick a unique name for it (e.g. MyUbuntuInstanceStaticIP):
aws lightsail allocate-static-ip --static-ip-name MyUbuntuInstanceStaticIP --region ap-southeast-2 --profile MyUbuntuProfile
2. Attach a public static IP address to the instance
aws lightsail attach-static-ip --static-ip-name MyUbuntuInstanceStaticIP --instance-name MyUbuntuInstance --region ap-southeast-2 --profile MyUbuntuProfile
3. Verify
aws lightsail get-static-ip --static-ip-name MyUbuntuInstanceStaticIP --region ap-southeast-2 --profile MyUbuntuProfile
4. Test the SSH Connection
Replace <STATIC_IP> with the address returned above:
ssh -i MyUbuntuInstanceKeyPair.pem ubuntu@<STATIC_IP>
If you see a “bad permissions” warning on Linux/macOS, re-run chmod 600 MyUbuntuInstanceKeyPair.pem.
On Windows, re-apply the icacls steps.
Clean up resources
Are you finished with your AWS Lightsail instance? Before you move on, take a few minutes to clean up all associated resources. Not only will this help you avoid surprise charges, but it will also keep your AWS account organized and secure.
1. Release the Static IP
If you have a static IP attached to your instance, make sure to release it first. Otherwise, AWS may keep charging you for the reserved IP.
aws lightsail release-static-ip --static-ip-name MyUbuntuInstanceStaticIP --region ap-southeast-2 --profile MyUbuntuProfile
2. Delete the Instance
Next, delete the AWS Lightsail instance. This action is permanent and will result in the loss of all data on the instance.
aws lightsail delete-instance --instance-name MyUbuntuInstance --region ap-southeast-2 --profile MyUbuntuProfile
3. Delete the SSH Key Pair in AWS Lightsail
Next, Delete the SSH Key Pair
aws lightsail delete-key-pair --key-pair-name MyUbuntuInstanceKeyPair --region ap-southeast-2 --profile MyUbuntuProfile
Further Reading
Using WordPress on AWS Lightsail and Docker
Installing AWS CLI
Summary
The AWS CLI is a command-line tool that lets you manage and automate AWS services including Lightsail using PowerShell, Command Prompt, or Terminal. With AWS CLI, you can automate tasks, configure AWS resources, and streamline the deployment and management of Lightsail instances, Docker containers, and WordPress environments.
Prerequisites
- Python (if applicable):
- Required only for AWS CLI v1 (installed via pip): Python 3.7 or later recommended.
- AWS CLI v2: Python is bundled; you don’t need to install it separately.
- Administrator or sudo privileges: Required for installation and configuration on most systems.
Installation
Tip: All commands below should be run in your system’s terminal, PowerShell, or command prompt.
Windows
Option 1: MSI Installer
- Download the installer from the official AWS CLI documentation.
- Run the installer (e.g.,
AWSCLIV2.msi).Or, run this command:msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
Option 2: Chocolatey
Chocolatey is a command-line package manager for Windows.
To install or upgrade AWS CLI:
choco upgrade awscli
Verify Installation
aws --version
Linux
Option 1: Official Bundled Installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
rm -rf awscliv2.zip aws/
Option 2: Snap (Ubuntu/Debian)
sudo snap install aws-cli --classic
Verify Installation
aws --version
macOS
Option 1: Homebrew
brew update
brew install awscli
Verify Installation
aws --version
Creating an IAM User Group for Lightsail Access
You can use either a service-linked role (created automatically by Lightsail) or set up a custom role with your own group and permissions.
1. Sign in to the AWS Management Console
- Go to the IAM (Identity and Access Management) service (search for “IAM” in the AWS Console search bar).
2. Create a User Group
- Navigate to User groups ? Create group.
- Name your group (e.g.,
LightsailUsers). - (Optional) Add users now, or skip and add later.
- Click Next.
3. Attach Permissions
- In Attach permissions policies, search for
AdministratorAccess. - Check the box for
AdministratorAccess. - Click Next, then Create group.
4. Add Users (if you didn�t earlier)
- In User groups, select your group.
- Go to the Users tab, click Create user.
5. Create User & Access Key
- Set a username (e.g.,
developer). - Leave console access unchecked (optional).
- On Permissions, choose Add user to group and pick
LightsailUsers. - Skip permission boundaries (optional).
- Click Create user.
Create Access Key:
- In Users, click your user’s name.
- Go to Security credentials tab, click Create access key.
- Select Command Line Interface (CLI).
- Confirm recommendations and continue.
- Download your credentials
.csvand store securely.
Tip: Tags (key-value pairs) can help organize and automate your Lightsail resources.
AWS CLI Configuration
1. Run the aws configure Command
aws configure
You’ll be prompted for:
- AWS Access Key ID: (From your downloaded
.csv) - AWS Secret Access Key: (From your downloaded
.csv) - Default region name: (e.g.,
ap-southeast-2) - Default output format: (
json,text, ortable)
These are stored as your default profile.
2. Add Additional Profiles (Optional)
You can create multiple named profiles (for different users/accounts):
aws configure --profile MyUbuntuProfile
3. Where Profiles Are Stored
Profiles are kept in two files:
- Linux/macOS:
~/.aws/ - Windows:
C:\Users\<YourUsername>\.aws\
Files:
credentials– stores access keysconfig– stores region and output format
Example:
~/.aws/credentials
[default]
aws_access_key_id = AKIAEXAMPLE1
aws_secret_access_key = secret1
[MyUbuntuInstance]
aws_access_key_id = AKIAEXAMPLE2
aws_secret_access_key = secret2
~/.aws/config
[default]
region = ap-southeast-2
output = json
[profile MyUbuntuInstance]
region = us-west-2
output = table
Using Multi-Profiles
Multi-profiles allow you to easily switch between AWS accounts, users, or environments from a single machine.
- View all profiles:
aws configure list-profiles - Use a profile:
aws s3 ls --profile default aws ec2 describe-instances --profile MyUbuntuProfile
Further Reading
Using WordPress on AWS Lightsail and Docker
Using WordPress on AWS Lightsail and Docker – Early Access Edition
Learn how to deploy WordPress on AWS Lightsail using Docker.
This book provides a clear, step-by-step guide to setting up the AWS CLI, creating a Lightsail virtual server, installing Docker, and deploying WordPress with Docker Compose.
You will also explore how to automate WordPress theme deployments using WP-CLI and CI/CD pipelines.
It is designed for developers, site owners, and technical users who want a simpler, more reliable, and more secure approach to WordPress deployment using DevOps practices.
Early Access Edition
Using WordPress on AWS Lightsail and Docker
and that was 2019 in Review.
This blog has been very quiet this year, lots of reasons, mostly work-related has kept me away.
Some milestones were achieved this year:
NovuscodeLibrary
NovuscodeLibrary is a Delphi library of utility functions and non-visual classes.
- New package NovusCodeLibrary_cURL.dpk – cURL function library
- New package NovusCodeLibrary_WebUtils.dpk – Web functions library
- Now support Delphi 10.3 and packages
https://github.com/novuslogic/NovuscodeLibrary
Adding features or fixing bugs to Novuscodelibrary, it’s general done organically. The next feature supported:
- The Delphi Package Manager Project https://github.com/DelphiPackageManager/
CodeImatic
CodeImatic is a PascalScript based toolchain for building and deployment.
CodeImatc.build
CodeImatic.build is a PascalScript based build and deployment engine.
https://github.com/novuslogic/CodeImatic.build
CodeImatc.codegen
CodeImatic.codegen is a PascalScript template driven source code and static website generator.
https://github.com/novuslogic/CodeImatic.codegen
CodeImatic – Multiple features have been added and moving towards an early beta release next year.
DelphiAWSSDK
The Delphi AWS SDK enables Delphi/Pascal developers to easily work with Amazon Web Services.
The next version of DelphiAWSDK v.04 will have a full translation of Amazon DynamoDB https://aws.amazon.com/dynamodb/ using the new experimental Code-Generation based on CodeImatic.codegen https://github.com/novuslogic/CodeImatic.codegen
Using WordPress on Amazon Lightsail
https://leanpub.com/wordpressawslightsail/
I’m develpoing a new book called “Using WordPress on Amazon Lightsail” which will be pushlished early next year, so sign up with the “Notify Me When This Is Published” button.
Happy New Year.
DelphiAWSSDK v0.2.0
The Delphi AWS SDK enables Delphi/Pascal developers to easily work with Amazon Web Services.
https://github.com/novuslogic/DelphiAWSSDK/releases/tag/v0.2.0
Summary of updates
- Updated support Delphi XE to Delphi X10.2
- Tested support for Windows 32/64Bit, MacOSX 32Bit
- New TAmazonIndyRESTClient and TAmazonDelphiRESTClient classes
- Updated TAmazonSignatureV4 class to be less reliant on Indy, allowing for cross-platform development.
- THashSHA2 supported in unit Amazon.Utils for Delphi XE8 and up.
Using WordPress on AWS EC2 Free Tier
Here is a guide on how to setup WordPress on Amazon EC2 Free Tier
Setup
-
Sign up for a AWS Account at http://aws.amazon.com/

-
Sign up for a Amazon EC2 at http://aws.amazon.com/ec2

- Sign into the AWS Console

-
Choose a Region before launching your new EC2 instance.

- Create EC2 Linux Micro Instance for WordPress:
- To start a new EC2 instance click on the Launch Instance button.

-
In the “Request Instances Wizard” tab to the Community AMI’s then filter using “wordpress” then choose the AMI:
bitnami-wordpress-3.1-0-linux-ubuntu-10.04-ebs (ami-30f18f62)

- For your Free instance, choose the number of instances: 1, Availability Zone: No Preference and Instance Type: Micro (t1 micro, 613MB).

- Shutdown Behavior option should be stop, and all other options Use Default.

-
Add in a tag key = Name and value = Webserver.

-
Create a new Key Par call it the name of the website then create and save this file somewhere on your local machine that can be grabbed latter. E.g xyz.pem

-
Adjust Security Groups,
Add rules for SSH, HTTP, HTTPS but leave the source as 0.0.0.0/0

- Now Lunch the instance

- Assign Elastic IP then Associate Address with your EC2 Instance
- Click on Instances within the EC2 console to find the Public DNS.

- Install Open SSH on Windows
-
Set pem file to Read by owner
chmod 400 xyz.pem
-
SSH in to the instance
ssh -i xyz.pem bitnami@ec2-<public DNS>.ap-southeast-1.compute.amazonaws.com
-
Move WordPress to run at the root of the apache web server by editing httpd.conf file using vi
sudo vi /opt/bitnami/apache2/conf/httpd.conf
DocumentRoot “/opt/bitnami/apache2/htdocs”
To
DocumentRoot “/opt/bitnami/apps/wordpress/htdocs”
<Directory />
Options Indexes MultiViews +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory “/opt/bitnami/apache2/htdocs”>
To
<Directory “/opt/bitnami/apps/wordpress/htdocs”>
Comment out:
#Include “/opt/bitnami/apps/wordpress/conf/wordpress.conf”
-
Create an .htaccess file for WordPress
This also enables you to have pretty permalinks like myblog.com/tour
Add .htaccess file to WordPress dir
in /opt/bitnami/apps/wordpress/htdocs/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !=/server-status
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
-
Configure WordPress to know its own DNS entry
sudo vi /opt/bitnami/apps/wordpress/htdocs/wp-config.php
define(‘WP_HOME’, ‘http://www.ringio.com’);
define(‘WP_SITEURL’, ‘http://www.ringio.com’);
-
Install Filezila
Public DNS
SSH Username: bitnami
Password: <Blank>
-
delete the /opt/bitnami/updateip file. Otherwise, restarting the instance, Bitnami resets the wp_options values to the Public DNS server name.
sudo rm /opt/bitnami/updateip
-
Install EMS MySQL Manager
How to Connect to BitNami MySQL Remotely
-
Run this SQL script to set the Pubic IP Address with WordPress
update wp_options set option_value = ‘http://www.agileweboperations.com’ where option_name in (‘siteurl’, ‘home’);
-
Configure WordPress with the Pubic IP Address
sudo vi /opt/bitnami/apps/wordpress/htdocs/wp-config.php
define(‘WP_HOME’, ‘http://www.ringio.com’);
define(‘WP_SITEURL’, ‘http://www.ringio.com’);
- Reboot the instance
- In your Browser type the public ip and see if WordPress is running correctly at Root Directory
-
Login into Woresspress using default bitnami username
Username: user
Password: bitnami
- Add a new use into WordPress with Role of Administrator
- Then remove default bitnami username from WordPress by login in as your new username
- Make a DNS A record for the domain host provider, and use the elastic IP.
Migration
- Both wordpress on your old site and on AWS are the same due to database compatible issues
-
Copy your \wp-content\upload from your old site locally to reload on AWS
sudo chmod 755 /opt/bitnami/apps/wordpress/htdocs/wp-content/
Install and download all plugins to your AWS Worspress instance
- Download or install your old theme and plugins
- Export your Old WordPress database using MyPHPAdmin
- Run the Export SQL Script on the AWS WordPress Instance using your Remote SQL Manager
-
The rerun the SQL script to set the Pubic IP Address with WordPress
update wp_options set option_value = ‘http://www.agileweboperations.com’ where option_name in (‘siteurl’, ‘home’);
To Finish
-
When your domain has delegated run this script again with your domain
update wp_options set option_value = ‘http://www.website.com’ where option_name in (‘siteurl’, ‘home’);
-
Configure WordPress with the Pubic IP Address
sudo vi /opt/bitnami/apps/wordpress/htdocs/wp-config.php
define(‘WP_HOME’, ‘http://www.website.com’);
define(‘WP_SITEURL’, ‘http://www.website.com’);
Links
Amazon Web Services
http://aws.amazon.com/
AWS Management Console
http://aws.amazon.com/console/
Bitnami Wordpres Stack
http://bitnami.org/stack/wordpress
OpenSSH
http://www.openssh.com/
http://sshwindows.webheat.co.uk/
Filezilla
http://filezilla-project.org/
How to Connect to BitNami MySQL Remotely
http://wiki.bitnami.org/cloud/how_to_connect_to_your_amazon_instance#How_to_connect_to_the_BitNami_MySQL_remotely.3f
EMS MySQL Manager
http://www.sqlmanager.net/products/mysql/manager
Moving to AWS
This blog will being moving to Amazon Web Services in the next week and a new theme. So there might be some down time.

You must be logged in to post a comment.