Creating the Dev environment

Let's first start off by creating a simple and straightforward development environment for our WordPress site. To do so, execute the following steps:

  1. Sign in to the AWS Console and select the Elastic Beanstalk option from the Services filter, or alternatively, launch the Elastic Beanstalk console by launching the URL https://console.aws.amazon.com/elasticbeanstalk in a browser of your choice.
  2. Next, select the Create New Application option to get started. Remember, an application is the highest level of container for our application code, which can contain one or more environments as required.
  3. In the Create New Application dialog box, provide a suitable Application Name and an optional Description to get started with. Click on Create once completed.
  4. With the basic application container created, you can now go ahead and create the development environment. To do so, from the Actions drop-down list, select the Create New Application option.
  5. Here, you will be provided with an option to either opt for the Web server environment or the Worker environment configuration. Remember, an environment type can be selected only once here, so make sure that you select the correct tier based on your application's requirements. In this case, I've opted to select the Web server environment, as shown in the following screenshot:
  1. On the Create a new environment wizard page, provide a suitable Environment name for your WordPress site. Since this is a development environment, I've gone ahead and named it YoyoWordpress-dev. Next, in the Domain field, provide a unique name for your website's domain URL. The URL will be suffixed by the region-specific Elastic Beanstalk URL, as shown in the following screenshot:
  1. Next, type in a suitable Description for your new environment, and move on toward the Base configuration section. Here, from the Platform dropdown, select the Preconfigured platform option and opt for the PHP platform, as depicted in the following screenshot. PHP is our default option as WordPress is built on PHP 5.6. Today, Beanstalk supports packer builder, Docker containers, Go, Java SE, Java with Tomcat, .NET on Windows Server with IIS, Node.js, PHP, Python, and Ruby, with more platform support coming shortly:
  1. Now, here's the part where you need to keep your calm! Leave the rest of the options as their default values and select Configure more options, not the Create environment option! Yes, we will be configuring a few additional items first and will create our development environment later!
  2. On the Configure Environment page, you can opt to select one of the three preconfigured Configuration presets options, based on your application's requirements. The presets are briefly explained here:
    • Low cost (Free tier eligible): This particular configuration will launch a single (t2.micro) instance with no load balancing or autoscaling group configured. This is ideal if you just want to get started with an application using the basics or wish to set up a minimalistic Dev environment, as in this case.
    • High availability: Unlike the low-cost preset, the high-availability configuration comes pre-equipped with an autoscaling group that can scale up to a default of four instances or more, and an Elastic Load Balancer that has cross-zone load balancing and connection draining enabled by default. Besides this, you also get a host of CloudWatch alarms created for monitoring, as well as security groups for your instance and Load Balancer.
    • Custom configuration: You can additionally opt to configure your environment based on other parameters. You can select this preset, and modify each and every component present within your environment as you see fit.
  1. With the Configuration preset set to Low cost (Free tier), the next item that we can modify is the Platform configuration. Elastic Beanstalk supports the following PHP platform configurations:

PHP Language

Amazon Linux AMI

PHP version

PHP 7.1

2017.03.1

PHP 7.1.7

PHP 7.0

2017.03.1

PHP 7.0.21

PHP 5.6

2017.03.1

PHP 5.6.31

PHP 5.5

2017.03.1

PHP 5.5.38

PHP 5.4

2017.03.1

PHP 5.4.45

  1. Since we are using a WordPress application, we need to modify the platform as well, to accommodate for the correct PHP version.

To do so, select the Change platform configuration option. This will bring up the Choose a platform version dialog, as shown here:

  1. Here, from the drop-down list, search and select the 64bit Amazon Linux 2017.03 v2.5.0 running PHP 5.6 option, as WordPress execution is stable with PHP 5.6. Once done, click on Save to complete the process.
  2. With the Platform configuration changed as per our requirements, we can now move on to configuring the add-on services such as security, notifications, network, database, and much more! For example, let's quickly configure the networking for our WordPress Dev environment by selecting the Modify option in the Network pane.
  1. In the Network pane, you can opt to launch your environment in a custom VPC, as well as other instance-specific settings such as enabling Public IP address, selecting the Instance subnets based on your VPC design, and finally assigning Instance security groups for your Dev instances. In this case, I already have a custom VPC created specifically for the development environment that contains one public subnet and one private subnet, with a default security group as well. Here is an overview of the network configuration setup for my environment. You can tweak this to match your requirements:
  1. Once the settings are made, click on Save to complete the networking changes. You can perform other configurational changes as you see fit, however, since this is only a development environment, I've opted to leave the rest of the options as default for now. Once completed, select the Create environment option to finish the environment creation process.

Once the environment creation process is initiated, it will take a couple of minutes to complete its execution, as depicted in the following screenshot. Here, you will see Elastic Beanstalk create a new security group as well as an Elastic IP address for your EC2 dev instance. During this stage, the environment also transitions from a Pending to an Ok state, and you can view the environment, your application's logs, and the status:

With your environment up and running, you can also verify it using the URL provided as an output of your environment's creation by using the environment dashboard. Upon selecting the URL, you will be redirected to a new application landing page in your web browser which basically verifies that your environment is configured to work with PHP 5.6.

But where is our WordPress application? That's exactly what we will be deploying next using a really simple and easy-to-use Elastic Beanstalk CLI.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset