Step 3.1: Add a Back-end Database - AWS OpsWorks

Step 3.1: Add a Back-end Database

Important

AWS OpsWorks Stacks is no longer accepting new customers. Existing customers will be able to use the OpsWorks console, API, CLI, and CloudFormation resources as normal until May 26, 2024, at which time they will be discontinued. To prepare for this transition, we recommend you transition your stacks to AWS Systems Manager as soon as possible. For more information, see AWS OpsWorks Stacks End of Life FAQs and Migrating your AWS OpsWorks Stacks applications to AWS Systems Manager Application Manager.

The new version of SimplePHPApp stores its data in a back-end database. AWS OpsWorks Stacks supports two types of database servers:

You can also use other databases, such as Amazon DynamoDB, or create a custom layer to support databases such as MongoDB. For more information, see Using a Back-end Data Store.

This example uses a MySQL layer.

To add a MySQL layer to MyStack
  1. On the Layers page, click + Layer.

  2. On the Add Layer page, for Layer type, select MySQL, accept the default settings, and click Add Layer.

To add an instance to the MySQL layer
  1. On the Layers page's MySQL row, click Add an instance.

  2. On the Instances page, under MySQL, click Add an instance.

  3. Accept the defaults and click Add instance, but don't start it yet.

Note

AWS OpsWorks Stacks automatically creates a database named using the app's short name, simplephpapp for this example. You'll need this name if you want to use Chef recipes to interact with the database.