To prepare to deploy WordPress using AWS Elastic Beanstalk, you must copy the WordPress files to your computer and provide some configuration information. AWS Elastic Beanstalk requires a source bundle, in the format of a ZIP or WAR file.
To download WordPress and create a source bundle
-
- Download the files in the following repository:
-
- Extract the configuration files into your
wordpress-beanstalk
folder.
- Extract the configuration files into your
-
- Verify that the structure of your
wordpress-beanstalk
folder is correct.
- Verify that the structure of your
-
-
├── .ebextensions
-
-
-
├── wp-admin
-
-
-
│ ├── css
-
-
-
│ ├── images
-
-
-
│ ├── includes
-
-
-
│ ├── js
-
-
-
│ ├── maint
-
-
-
│ ├── network
-
-
-
│ └── user
-
-
-
├── wp-content
-
-
-
│ ├── plugins
-
-
-
│ └── themes
-
-
-
├── wp-includes
-
-
-
│ ├── certificates
-
-
-
│ ├── css
-
-
-
│ ├── customize
-
-
-
│ ├── fonts
-
-
-
│ ├── ID3
-
-
-
│ ├── images
-
-
-
│ ├── js
-
-
-
│ ├── pomo
-
-
-
│ ├── random_compat
-
-
-
│ ├── Requests
-
-
-
│ ├── rest-api
-
-
-
│ ├── SimplePie
-
-
-
│ ├── Text
-
-
-
│ ├── theme-compat
-
-
-
│ └── widgets
-
-
- Modify the configuration files in the
.ebextensions
folder with the IDs of your default VPC and subnets, and your public IP address.
- Modify the configuration files in the
-
-
- The
.ebextensions/efs-create.config
file creates an EFS file system and mount points in each Availability Zone/subnet in your VPC. Identify your default VPC and subnet IDs in the Amazon VPC console. The default config is for a simple non-load balanced eb application. If you choose to use a load balancer and multiple subnets, please un-comment out subnets.
- The
-
-
-
-
- Keys and Salts
-
-
-
-
-
-
- VPCId –
vpc-XXXXXXX
- VPCId –
-
-
-
-
-
-
-
- SubnetA –
subnet-XXXXXXX
- SubnetA –
-
-
-
-
-
- The
.ebextensions/dev.config
file restricts access to your environment to your IP address to protect it during the WordPress installation process. Replace the placeholder IP address near the top of the file with your public IP address.
- The
-
-
-
- The
.ebextensions/wordpress.config
file creates environmental variables. It is here is can update keys and salts, these properties are all set todefault
. In addition it is here, your RDS configuration parameters should be updated.
- The
-
-
-
-
- Keys and Salts
-
-
-
-
-
-
- AUTH_KEY –
default
- AUTH_KEY –
-
-
-
-
-
-
-
- SECURE_AUTH_KEY –
default
- SECURE_AUTH_KEY –
-
-
-
-
-
-
-
- LOGGED_IN_KEY –
default
- LOGGED_IN_KEY –
-
-
-
-
-
-
-
- NONCE_KEY –
default
- NONCE_KEY –
-
-
-
-
-
-
-
- AUTH_SALT –
default
- AUTH_SALT –
-
-
-
-
-
-
-
- SECURE_AUTH_SALT –
default
- SECURE_AUTH_SALT –
-
-
-
-
-
-
-
- NONCE_SALT –
default
- NONCE_SALT –
-
-
-
-
-
-
- RDS Configuration
-
-
-
-
-
-
- RDS_DB_NAME –
rdsdb
- RDS_DB_NAME –
-
-
-
-
-
-
-
- RDS_HOSTNAME –
default
- RDS_HOSTNAME –
-
-
-
-
-
-
-
- RDS_PORT –
3306
- RDS_PORT –
-
-
-
-
-
-
-
- RDS_USERNAME –
rdsuser
- RDS_USERNAME –
-
-
-
-
-
-
-
- RDS_PASSWORD –
rdspassword
- RDS_PASSWORD –
-
-
-
-
- Create a ZIP file from the files and folders in the
wordpress-beanstalk
folder (not the parent directory), using one of the following methods, depending on your operating system:
- Create a ZIP file from the files and folders in the
-
- Windows — In Windows Explorer, select the files and folders, right-click, and then choose Send to, Compressed (zipped) Folder. Name the file
wordpress-beanstalk-x.y.z.zip
, wherex.y.z
is the version of WordPress.–OR–Mac OS X and Linux — Use the following command, wherex.y.z
is the version of WordPress:
- Windows — In Windows Explorer, select the files and folders, right-click, and then choose Send to, Compressed (zipped) Folder. Name the file
-
-
zip -r ../wordpress-beanstalk-x.y.z.zip .
-
Launch an Elastic Beanstalk Environment
Use the AWS Management Console to launch an Elastic Beanstalk environment.
- Open the Elastic Beanstalk console
- For Domain, leave blank and it will autogenerate a value.
- For Platform, choose PHP.
- For App code, choose Upload your code.
- Choose Upload and navigate to the ZIP file you created for your WordPress files.
- Choose Upload to select your application code.
- Choose Review and launch
- For Configuration presets, select Custom configuration.
- Choose Change platform configuration and select 64bit Amazon Linux 2017.03 v2.4.4 running PHP 5.6 from the drop down menu and then choose Save.
- Review all options and once you are satisfied with those options choose Create app.
Environment creation takes about 5 minutes.
Configure Security Groups and Environment Properties
Next, add the DB instance’s security group to your running environment. This procedure causes Elastic Beanstalk to reprovision all instances in your environment with the additional security group attached.
To add a security group to your environment
- Open the Elastic Beanstalk console.
- Navigate to the management page for your environment.
- Choose Configuration.
- In the Instances section, choose the settings icon ( ).
- For EC2 security groups, type a comma after the name of the autogenerated security group followed by the name of the RDS DB instance’s security group. It is the name you noted while configuring the security group earlier.
- Choose Apply.
- Read the warning, and then choose Save.
Next, pass the connection information to your environment by using environment properties. The sample application uses a default set of properties that match the ones that Elastic Beanstalk configures when you provision a database within your environment.
I’ve always had a passion for solving complex problems, but I’ve never liked to do it the “normal” way. The digital product space is still the Wild West of technology, a place you can imagine an idea, prototype it quickly and cheaply, and bring it to market on your own (or at least with a small, tight team). There’s an ethos you have to follow, sure, but how you do it isn’t as important as that you get it done. I’m a huge advocate for renegade product makers out to change the world.