Setup LAMP Server in EC2 Instance with Puppet

Setup LAMP Server in EC2 Instance with Puppet

Introduction

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.

Prerequisites

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

Solution

Install & Configure puppet

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

To explore more, follow the links below:

http://terokarvinen.com/2012/puppetmaster-on-ubuntu-12-04

https://www.digitalocean.com/community/tutorials/how-to-install-puppet-to-manage-your-server-infrastructure

Setup AWS CLI

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

http://www.treselle.com/blog/install-amazon-cli-tools/

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

create_key_pair

Grant permission

Create security groups

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

create_security_groups

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

authorize_test_security

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 http://ec2-XX-XX-XX-XX.compute-1.amazonaws.com

apache2_ubuntu_page

Check the PHP version

php_version

Check the MySQL services.

check_mysql_services

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

Conclusion

  • 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

References

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

To learn more about Puppet, click the links below:

4582 Views 3 Views Today