Setup LAMP Server in EC2 Instance with Puppet

Setup LAMP Server in EC2 Instance with Puppet



Puppet is an open-source tool that assists system administrators to manage server configurations. Puppet makes automation easy and simplifies standardizing configurations across multiple Linodes or other servers for both the front end and the backend.

Why use Puppet?

  • Saves time for deployment
  • Avoids repetitive tasks
  • Manages Physical and Virtual devices including cloud
  • Maintains System Consistency and Integrity

Use case

This use case explains how to create AWS EC2 Instance through AWS-CLI commands and Setup LAMP (Apache, MySQL and PHP) services using Puppet.


  • Install & Configure Puppet
  • Setup AWS CLI tools
  • Create AWS EC2 instance with Puppet
  • Install LAMP services with Puppet


Install & Configure puppet

Extensive blog resources on how to install & configure Puppets are available.

To explore more, follow the links below:


Our previous blog post “Install Amazon CLI Tools” detailed the installation procedures. Click the link below for further reference:

Create EC2 Instances with Puppet

To create EC2 instance, follow the steps below:

  • Create a key pair
  • Create a Security group
  • Create EC2 instance with ensure puppet service

Create a key pair


Grant permission

Create security groups

Create “test-security-group” for AWS EC2 with the following command:


Follow the commands below to add security rules SSH-22 and RDP-3389 into test-security-group:


Install puppet service

Let us create a bash script to install puppet service.

Next, create EC2 instance with the command below:

Finally, we have succeeded in creating a new EC2 instance!!!!

Setup LAMP on EC2 instance through Puppet service

Step 1: Create a module under puppet configuration and install the lamp server.

Step 2: Follow the commands below to create a manifest file:

Now apply the puppet

Now, the puppet has been successfully applied.

Next, let’s check whether LAMP has been installed on EC2 instance.

Open browser and check


Check the PHP version


Check the MySQL services.


Good job! You have successfully setup a LAMP with Puppet! Happy Puppeting…


  • EC2 instance can be created through AWS-CLI commands
  • Amazon provides AWS-CLI commands that can manage the entire EC2 instance process in AWS Management console
  • Puppet is a remarkable tool for automation and deployment in IT infrastructure


To know more about CLI Commands, follow the link below:

To learn more about Puppet, click the links below:

5993 Views 1 Views Today