Coder Social home page Coder Social logo

puppetlabs-amazon_aws's Introduction

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

puppetlabs-amazon_aws's People

Contributors

gregohardy avatar florindragos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.