Creating a Layer in AWS OpsWorks

Lab Steps

lock
Logging In to the Amazon Web Services Console
lock
Creating a Stack in AWS OpsWorks
lock
Creating a Layer in AWS OpsWorks
lock
Creating and Deploying an Application in AWS OpsWorks
lock
Deleting a Stack in AWS OpsWorks
Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

In this lab step, you will create a layer in AWS OpsWorks that will represent and hold the instances to make up your PHP application servers.

 

Instructions

1. Click Add a layer:

alt

 

2. Ensure the OpsWorks layer type is selected and then configure the following fields:

  • Layer type: Select PHP App Server

This lab step does not cover attaching an Elastic Load Balancer (ELB) to the stack layer, but in a real-world setting, an ELB can evenly distribute traffic to the instances in this layer and improve the performance of your application.

To learn more about how an Elastic Load Balancer can improve your application, check out the AWS OpsWorks User Guide.

 

3. Click Add Layer: 

alt

This will bring you to the Layers page.

 

4. Click the Network setting under PHP App Server:

alt

By default, instances launched in this layer will only receive a private IP address, which is not accessible from outside the VPC. For your application, you will need to configure this layer to automatically assign a public IP address to each instance launched in the layer. 

 

5. Click the toggle setting next to Public IP addresses to switch it to Yes:

alt

 

6. Click Save:

alt

 

7. At the top-right of the Layer PHP App Server page, click Instances:

alt

 

8. Click Add an instance:

alt

 

9. Ensure that the New tab is selected and click Advanced>> to expand all settings.

 

10. Configure the following fields:

  • Size: Select t2.micro
  • Operating system: Ensure Amazon Linux 2017.09 is selected

 

11. Click Add Instance:

alt

Your php-app1 instance will be created but will notice it will have a Status of stopped. Adding an instance to a layer does not automatically start that instance. 

alt

 

12. Click Start All Instances: 

alt

Starting your php-app1 instance can take up to 10 minutes. 

During this time, the Status of your instance will be updated. Each status represents a different action AWS OpsWorks is performing on your behalf:

  • requested: AWS OpsWorks has called the Amazon EC2 service to create the Amazon EC2 instance
  • pending: AWS OpsWorks is waiting for the Amazon EC2 instance to start
  • booting: The Amazon EC2 instance is booting
  • running_setup: AWS OpsWorks has triggered the Setup event and is running the layer's Setup recipes, followed by its Deploy recipes. 
  • online: The instance is ready for use

Consider reading Using AWS OpsWorks Instances while you wait for your instance to boot up, or at a later time. EC2 instances are the "workers" of the AWS OpsWorks service, so it's beneficial to understand how to optimize this compute resource when working with AWS OpsWorks.

 

13. Wait for the status of your instance to update to a Status of online:

alt

 

Summary

In this lab step, you created a layer in AWS OpsWorks that represents your PHP application servers.

Validation checks
1Checks
Created the OpsWork Layer

Check that the OpsWork Layer has been created.

AWS OpsWorks