Deploy WordPress Using the Elastic Beanstalk Environment

Deploy WordPress Using the Elastic Beanstalk Environment

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

    1. Download the files in the following repository:
    1. https://github.com/swaddell/aws-elastic-beanstalk-wordpress-4.8.2/archive/wordpress-beanstalk.zip
    1. Extract the configuration files into your wordpress-beanstalk folder.
    1. Verify that the structure of your wordpress-beanstalk folder is correct.
    1. ├── .ebextensions
    1. ├── wp-admin
    1. │ ├── css
    1. │ ├── images
    1. │ ├── includes
    1. │ ├── js
    1. │ ├── maint
    1. │ ├── network
    1. │ └── user
    1. ├── wp-content
    1. │ ├── plugins
    1. │ └── themes
    1. ├── wp-includes
    1. │ ├── certificates
    1. │ ├── css
    1. │ ├── customize
    1. │ ├── fonts
    1. │ ├── ID3
    1. │ ├── images
    1. │ ├── js
    1. │ ├── pomo
    1. │ ├── random_compat
    1. │ ├── Requests
    1. │ ├── rest-api
    1. │ ├── SimplePie
    1. │ ├── Text
    1. │ ├── theme-compat
    1. │ └── widgets
    1. Modify the configuration files in the .ebextensions folder with the IDs of your default VPC and subnets, and your public IP address.
      • 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.
        • Keys and Salts
          • VPCIdvpc-XXXXXXX
          • SubnetAsubnet-XXXXXXX
      • 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 .ebextensions/wordpress.config file creates environmental variables. It is here is can update keys and salts, these properties are all set to default. In addition it is here, your RDS configuration parameters should be updated.
        • Keys and Salts
          • AUTH_KEYdefault
          • SECURE_AUTH_KEYdefault
          • LOGGED_IN_KEYdefault
          • NONCE_KEYdefault
          • AUTH_SALTdefault
          • SECURE_AUTH_SALTdefault
          • NONCE_SALTdefault
        • RDS Configuration
          • RDS_DB_NAMErdsdb
          • RDS_HOSTNAMEdefault
          • RDS_PORT3306
          • RDS_USERNAMErdsuser
          • RDS_PASSWORDrdspassword
    1. 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:
    1. 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, where x.y.z is the version of WordPress.–OR–Mac OS X and Linux — Use the following command, where x.y.z is the version of WordPress:
    1. zip -r ../wordpress-beanstalk-x.y.z.zip .

Launch an Elastic Beanstalk Environment

Use the AWS Management Console to launch an Elastic Beanstalk environment.

  1. Open the Elastic Beanstalk console
  2. For Domain, leave blank and it will autogenerate a value.
  3. For Platform, choose PHP.
  4. For App code, choose Upload your code.
  5. Choose Upload and navigate to the ZIP file you created for your WordPress files.
  6. Choose Upload to select your application code.
  7. Choose Review and launch
  8. For Configuration presets, select Custom configuration.
  9. 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.
  10. 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

  1. Open the Elastic Beanstalk console.
  2. Navigate to the management page for your environment.
  3. Choose Configuration.
  4. In the Instances section, choose the settings icon ( Edit).
  5. 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.
  6. Choose Apply.
  7. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.