Bootstrapper to launch WordPress in an AWS Elastic Beanstalk single instance with Let's Encrypt, configurable through environment variables
This project is ready to be deployed to Elastic Beanstalk under a single instance, featuring:
- WordPress pre-installed, admin area accessible under
/wp/wp-admin/ - HTTPS through Let's Encrypt
- Cronjob to automatically renew the Let's Encrypt certificate
- All information is set through environment variables
Via Composer:
composer create-project leoloso/awseb-le-wp-installAfter bootstrapping this project, add your own code, and deploy!
Define the following environment variables in the Elastic Beanstalk application's configuration (under entry "Software"), or using CLI command eb setenv:
- WordPress configuration (
wp-config.php):
DB_NAME={YOUR_SITE_DB_NAME} #eg: database
DB_USER={YOUR_SITE_DB_USER} #eg: admin
DB_PASSWORD={YOUR_SITE_DB_PASSWORD} #eg: sADF!kl9diq@#Sjfk
DB_HOST={YOUR_SITE_DB_HOST} #eg: 127.0.0.1
SITE_URL_WITHOUT_HTTP={YOUR_SITE_URL_WITHOUT_HTTP} #eg: yourdomain.com
SITE_URL_WITH_HTTP={YOUR_SITE_URL_WITH_HTTP} #eg: https://yourdomain.com
SITE_NAME="{YOUR_SITE_NAME}" #eg: "My awesome website"
ADMIN_USER={ADMIN_USER} #eg: admin
ADMIN_PASSWORD={ADMIN_PASSWORD} #eg: JKo$@sfjASD00w
ADMIN_EMAIL={ADMIN_EMAIL} #eg: pedro@example.comTo set the SALT keys there are two alternatives:
I. Set random values through environment variable SHUFFLE_SALT_KEYS:
SHUFFLE_SALT_KEYS=trueII. Set the corresponding values directly:
# Obtain random values from https://api.wordpress.org/secret-key/1.1/salt
AUTH_KEY={YOUR_AUTH_KEY}
SECURE_AUTH_KEY={YOUR_SECURE_AUTH_KEY}
LOGGED_IN_KEY={YOUR_LOGGED_IN_KEY}
NONCE_KEY={YOUR_NONCE_KEY}
AUTH_SALT={YOUR_AUTH_SALT}
SECURE_AUTH_SALT={YOUR_SECURE_AUTH_SALT}
LOGGED_IN_SALT={YOUR_LOGGED_IN_SALT}
NONCE_SALT={YOUR_NONCE_SALT}- Let's Encrypt configuration:
LETSENCRYPT_DOMAIN={YOUR_LETSENCRYPT_DOMAIN} # Domain to register: yourdomain.com
LETSENCRYPT_EMAIL={YOUR_EMAIL} # eg: pedro@example.com
LETSENCRYPT_OPTIONS={YOUR_LETSENCRYPT_OPTIONS} # Can be used to pass "--dry-run" to avoid re-registering the certificate when launching a new server instanceThe Let's Encrypt configuration was mostly taken from Radek Zajkowski's article Elastic Beanstalk and Let’s Encrypt.
Installing WordPress through Composer and WP-CLI is based another project of mine.
The MIT License (MIT). Please see License File for more information.