amazon_aws

pdk
tasks
AWS module for management of Amazon Web Services (AWS) resources

Puppet

puppetlabs

15,356 downloads

10,513 latest version

5.0 quality score

Version information

  • 0.3.0 (latest)
  • 0.2.0
  • 0.1.0
released Apr 1st 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    windows
Tasks:
  • cloudfront_aws_list_distributions2018_11_05
  • alexaforbusiness_aws_delete_skill_group
  • glue_aws_stop_crawler
  • iot_aws_describe_thing
  • iot_aws_describe_thing_group
  • alexaforbusiness_aws_delete_user
  • alexaforbusiness_aws_get_address_book
  • and 3298 more. See all tasks
Plans:
  • create_kubernetes_cluster
  • create_vpc_vm

Start using this module

Documentation

puppetlabs/amazon_aws — version 0.3.0 Apr 1st 2019

Amazon AWS

Table of contents

  1. Description
  2. Setup
  3. Usage
  4. Reference

Description

Amazon AWS exposes an API for creating and managing its Infrastructure as a Service platform. By leveraging the power of Puppet code, the module enables you to interact with the AWS API to manage your AWS resources, and provides you with the ability to run Puppet tasks on target EC2 instances.

The module is generated from the AWS API specifications and utilizes the AWS Ruby SDK. For additional information, see the AWS SDK for Ruby documentation.

Setup

Installing the module

Install the retries gem and the Amazon AWS Ruby SDK gem, using the same Ruby used by Puppet.

If using Puppet 4.x or higher, install the gems by running the following command:

/opt/puppetlabs/puppet/bin/gem install aws-sdk retries

Set the following environment variables specific to your AWS installation:

export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
export AWS_REGION=your_region

To install the module, run the following command:

puppet module install puppetlabs-amazon_aws

Validating the module

This module is compliant with the Puppet Development Kit (PDK), which provides the tool to help validate the modules's metadata, syntax, and style. When you run validations, PDK output tells you which validations it is running and notifies you of any errors or warnings it finds for each type of validation; syntax, code style, and metadata.

To run all validations against this module, run the following command:

pdk validate ruby
pdk validate metadata

To change validation behavior, add options flags to the command. For a complete list of command options and usage information, see the PDK command reference.

Usage

Create a virtual machine and subnet

Create an Ubuntu server v16.04:

aws_instances { your_vm:
  ensure             => 'present',
  image_id           => 'ami-c7e0c82c',
  min_count          => 1,
  max_count          => 1,
  key_name           => your-key-name,
  instance_type      => 't2.micro',
  subnet_id          => your-subnet-id,
  tag_specifications => [ { resource_type => "instance", tags => $tag } ]
}

Create a subnet:

aws_subnet{ your_subnet:
  name       => your_subnet,
  cidr_block => 10.9.12.0/24,
  vpc_id     => your_vpc_id,
  ensure     => present,
}

Run a task

Create a VPC:

bolt task run --nodes localhost amazon_aws::ec2_aws_create_vpc cidr_block=10.200.0.0/16

Examples

Note: Due to validation checks carried out by the Resource API, when running any example you receive a warning that states the provider returned data that did not match the Type schema for a specific resource. This warning message can be ignored. The warning is due to mismatched data between an object, and it's property.

In the examples directory you will find:

  • create_vm.pp to create a EC2 virtual machine.
  • create_subnet.pp to create a subnet for the virtual machine.
  • task_example.sh contains a number of sample tasks, each using Puppet Bolt:
    • create and describe Amazon VPCs.
    • create, list, describe, or delete an Amazon EKS cluster.
    • list or delete an AWS Storage Gateway.
    • create or list Amazon S3 buckets.

In the legacy examples directory are examples from the legacy module on how to create an infrastructure using this new module:

Reference

Resources