How to do it...

We'll create a simple instance in this example. To create an instance, we need a minimum environment. We need a VPC (a Virtual Private Cloud). Our VPC will need a network, a security group, and a default route:

  1. Create a new module to hold the code. You can use PDK, puppet module generate, or just make the directories. I'm using the name cookbook_aws.
  2. Create an init.pp file to contain the cookbook_aws class:
# AWS classclass cookbook_aws (  String $availability_zone = 'us-west-2a',  String $region = 'us-west-2',  String $vpc = 'cookbook_aws',) {  include cookbook_aws::instance  include cookbook_aws::network  include cookbook_aws::securitygroup  include cookbook_aws::vpc  Class['cookbook_aws::vpc'] -> Class['cookbook_aws::securitygroup'] ...

Get Puppet 5 Cookbook - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.