AWS
Installing AWS CLI
Using WordPress on AWS Lightsail and Docker
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 – 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.