Creating a Layer in AWS OpsWorks

Lab Steps

Logging In to the Amazon Web Services Console
Creating a Stack in AWS OpsWorks
Creating a Layer in AWS OpsWorks
Creating and Deploying an Application in AWS OpsWorks
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.


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.



1. Click Add a layer:



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


This will bring you to the Layers page.


4. Click the Network setting under PHP App Server:


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:



6. Click Save:



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



8. Click Add an instance:



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:


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. 



12. Click Start All Instances


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:




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

Validation checks
Created the OpsWork Layer

Check that the OpsWork Layer has been created.

AWS OpsWorks