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:
-
The MySQL AWS OpsWorks Stacks layer is a blueprint for creating Amazon EC2 instances that host a MySQL database master.
-
The Amazon RDS service layer provides a way to incorporate an Amazon RDS instance into a stack.
You can also use other databases, such as Amazon DynamoDB, or create a custom layer to support
databases such as MongoDB
This example uses a MySQL layer.
To add a MySQL layer to MyStack
-
On the Layers page, click + Layer.
-
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
-
On the Layers page's MySQL row, click Add an instance.
-
On the Instances page, under MySQL, click Add an instance.
-
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