Skip to main content

AWS Puppet deployments

AWS Puppet for streamlined deployments

If you’re interested in automating and simplifying control over your application deployments, then Puppet – in any of its iterations – is probably a good place to start. And an AWS Puppet project can present a particularly good match.
Don’t think of this as an all-in quick start guide. The complexity of the kinds of network infrastructure that AWS Puppet deployments are designed to manage makes the word “quick” pretty much incompatible with the word “guide.” However I believe that this post should be useful as an orientation, to introduce you to the kind of things Puppet can do and some of the ways to do them. By the way, even though Puppet is obviously not an AWS product (it’s actually the brainchild of PuppetLabs), I’m going to use the phrase “AWS Puppet” in this post as a convenient way to describe the ways they can work together.

AWS PuppetHow Puppet works

Let’s say you’re running ten or fifteen Ubuntu web servers within an AWS VPC. The odds are that you will need to make configuration and content changes to each of these machines fairly often, but the process – especially as the number of servers grows – can be tedious.
Using Puppet, you can set up each server as an Agent that will, every thirty minutes or so, query a file called a manifest that lives on a separate AWS Puppet Master machine. If the manifest file, as it relates to a specific Agent, has changed since the last query, its current instructions will be immediately executed on that Agent.
This way, you can precisely and automatically control the ongoing configuration of any number of virtual (or actual) machines – running Linux/Unix or Windows – from a single file. It couldn’t get more simple. But that doesn’t mean it can’t get complicated.

Packages – AWS Puppet Master

Once you’ve created the EC2 instance that will serve as your Puppet master, you’ll have to install a Puppet package. Even if you’re limited to the open source version, there is still quite a selection of packages to choose from.
We’ll assume that we’re working with an AWS Ubuntu 14.04 AMI. For simplicity, I’ll use the puppetmaster-passenger package that’s found in the apt-get repositories. This package comes out of the box with everything you’ll need for connectivity, including Apache.

sudo apt-get update
sudo apt-get install puppetmaster-passenger


Puppet Agent

You’ll also have to install the Puppet Agent on each server – or Node – you’d like to be automatically controlled by your AWS Puppet Master. Once again, there is a choice of packages, but we’ll go with the apt-get repository:

sudo apt-get update
sudo apt-get install puppet

You’ll have to enable the Puppet Agent by editing its puppet file:

sudo nano /etc/default/puppet

…So that the START line looks like this:



We’re not even going to begin discussing many of the basic configuration elements you would need for a production deployment. Therefore, take it as given that you’ll have to properly configure your DNS, NTP, and SSL certificates. Here’s a great resource that addresses these issues in some detail.
You could, by the way, set up your DNS services using an old and reliable open source package like Unbound but, since we are working with AWS infrastructure, why ignore the obvious integrated solution: Route53?
You will probably also want lock the release version of each installed AWS Puppet package – both on the Master and on each Agent – to prevent unexpected version updates…which can have unpredictable results.

AWS Puppet Files

The file that matters the most for Puppet (on an Ubuntu installation) is /etc/puppet/puppet.conf. Here’s a example of what it might look like:

# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY

This config file tells Puppet (and you) where to find key system resources, including Puppet’s log files and SSL certificates.
The files that do all the heavy lifting for Puppet are called Manifests, and use a .pp extension. Here’s a simple example:

file {'/tmp/local-ip':
  ensure  => present,
  mode    => 0644,
  content => "My Public IP Address is: ${ipaddress_eth0}.\n",

This manifest will create a file named local-ip in the /tmp directory, assign it read-only permissions for everyone except the owner (0644), and populate it with a script that will output the public IP address of the eth0 interface from whichever machine it’s running on.

Common Puppet Commands

Start a manifest file:

puppet apply web-servers1-2.pp

Create a new group:

sudo puppet resource group puppet ensure=present

Create a new user:

sudo puppet resource user puppet ensure=present gid=puppet shell='/sbin/nologin'

Specify a single Node (or group of Nodes)

You can apply particular configuration details to specific Nodes within a general manifest file using the “node” declaration:

node 'web-server1' {
  include apache
  class { 'ntp':
    enable => false;
  apache::vhost { '':
    port    => '80',
    docroot => '/var/www/example',
    options => 'Indexes MultiViews'.

(The above example also shows how to deploy pre-baked modules provided by either the Puppet team or the user community.)

Launching manifests

Finally, you can create and run manifests directly from the command line. You might, for instance, want to create a file with local IP information (using our example from above). Assuming that we named that file local-info.pp, and saved it to the AWS Puppet Manifests directory, you could run it using:

sudo puppet apply /etc/puppet/manifests/local-info.pp


Written by

David Clinton

A Linux system administrator with twenty years' experience as a high school teacher, David has been around the industry long enough to have witnessed decades of technology trend predictions; most of them turning out to be dead wrong.

Related Posts

Sanket Dangi
— February 11, 2019

WaitCondition Controls the Pace of AWS CloudFormation Templates

AWS's WaitCondition can be used with CloudFormation templates to ensure required resources are running.As you may already be aware, AWS CloudFormation is used for infrastructure automation by allowing you to write JSON templates to automatically install, configure, and bootstrap your ...

Read more
  • AWS
Andrew Larkin
— January 24, 2019

The 9 AWS Certifications: Which is Right for You and Your Team?

As companies increasingly shift workloads to the public cloud, cloud computing has moved from a nice-to-have to a core competency in the enterprise. This shift requires a new set of skills to design, deploy, and manage applications in cloud computing.As the market leader and most ma...

Read more
  • AWS
  • AWS certifications
Andrew Larkin
— November 28, 2018

Two New EC2 Instance Types Announced at AWS re:Invent 2018 – Monday Night Live

The announcements at re:Invent just keep on coming! Let’s look at what benefits these two new EC2 instance types offer and how these two new instances could be of benefit to you. If you're not too familiar with Amazon EC2, you might want to familiarize yourself by creating your first Am...

Read more
  • AWS
  • EC2
  • re:Invent 2018
Guy Hummel
— November 21, 2018

Google Cloud Certification: Preparation and Prerequisites

Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2018, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the first time. In t...

Read more
  • AWS
  • Azure
  • Google Cloud
Khash Nakhostin
Khash Nakhostin
— November 13, 2018

Understanding AWS VPC Egress Filtering Methods

In order to understand AWS VPC egress filtering methods, you first need to understand that security on AWS is governed by a shared responsibility model where both vendor and subscriber have various operational responsibilities. AWS assumes responsibility for the underlying infrastructur...

Read more
  • Aviatrix
  • AWS
  • VPC
Jeremy Cook
— November 10, 2018

S3 FTP: Build a Reliable and Inexpensive FTP Server Using Amazon’s S3

Is it possible to create an S3 FTP file backup/transfer solution, minimizing associated file storage and capacity planning administration headache?FTP (File Transfer Protocol) is a fast and convenient way to transfer large files over the Internet. You might, at some point, have conf...

Read more
  • Amazon S3
  • AWS
Guy Hummel
— October 18, 2018

Microservices Architecture: Advantages and Drawbacks

Microservices are a way of breaking large software projects into loosely coupled modules, which communicate with each other through simple Application Programming Interfaces (APIs).Microservices have become increasingly popular over the past few years. The modular architectural style,...

Read more
  • AWS
  • Microservices
Stuart Scott
— October 2, 2018

What Are Best Practices for Tagging AWS Resources?

There are many use cases for tags, but what are the best practices for tagging AWS resources? In order for your organization to effectively manage resources (and your monthly AWS bill), you need to implement and adopt a thoughtful tagging strategy that makes sense for your business. The...

Read more
  • AWS
  • cost optimization
Stuart Scott
— September 26, 2018

How to Optimize Amazon S3 Performance

Amazon S3 is the most common storage options for many organizations, being object storage it is used for a wide variety of data types, from the smallest objects to huge datasets. All in all, Amazon S3 is a great service to store a wide scope of data types in a highly available and resil...

Read more
  • Amazon S3
  • AWS
Cloud Academy Team
— September 18, 2018

How to Optimize Cloud Costs with Spot Instances: New on Cloud Academy

One of the main promises of cloud computing is access to nearly endless capacity. However, it doesn’t come cheap. With the introduction of Spot Instances for Amazon Web Services’ Elastic Compute Cloud (AWS EC2) in 2009, spot instances have been a way for major cloud providers to sell sp...

Read more
  • AWS
  • Azure
  • Google Cloud
  • SpotInst
Guy Hummel and Jeremy Cook
— August 23, 2018

What are the Benefits of Machine Learning in the Cloud?

A Comparison of Machine Learning Services on AWS, Azure, and Google CloudArtificial intelligence and machine learning are steadily making their way into enterprise applications in areas such as customer support, fraud detection, and business intelligence. There is every reason to beli...

Read more
  • AWS
  • Azure
  • Google Cloud
  • Machine Learning
Stuart Scott
— August 17, 2018

How to Use AWS CLI

The AWS Command Line Interface (CLI) is for managing your AWS services from a terminal session on your own client, allowing you to control and configure multiple AWS services.So you’ve been using AWS for awhile and finally feel comfortable clicking your way through all the services....

Read more
  • AWS