百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

puppetlabs-aws

> 编程语言
开源

用于管理 AWS 资源以构建基础架构的 Puppet 模块

186 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于管理 AWS 资源以构建基础架构的 Puppet 模块

Table of Contents

  1. Overview
  2. Description - What the module does and why it is useful
  3. Setup
  • Requirements
  • Installing the aws module
  1. Usage - Configuration options and additional functionality
  • Creating resources
  • Creating a stack
  • Managing resources from the command line
  • Managing AWS infrastructure
  1. Reference - An under-the-hood peek at what the module is doing and how
  • Types
  • Parameters
  1. Limitations - OS compatibility, etc.

Future

The Amazon AWS module, which supersedes this module, supports over 2600 tasks, types, providers, and the Resource API.

To try it out, visit the Puppet Forge or view the Github repo.

This AWS module will eventually deprecate in the future.

Overview

The aws module manages Amazon Web Services (AWS) resources to build out cloud infrastructure.

Description

Amazon Web Services exposes a powerful API for creating and managing its infrastructure as a service platform. The aws module allows you to drive that API using Puppet code.

In the simplest case, this allows you to create new EC2 instances from Puppet code. More importantly, it allows you to describe your entire AWS infrastructure and to model the relationships between different components.

This module now includes tasks which will facilitate in installing the module dependencies and listing a subset of EC2 instances for you.

Setup

Requirements

  • Puppet 4.7 or greater
  • Ruby 1.9 or greater
  • Amazon AWS Ruby SDK (available as a gem)
  • Retries gem

Installing the aws module

  1. Install the retries gem and the Amazon AWS Ruby SDK gem, using the same Ruby used by Puppet. For Puppet 4.x and beyond, install the gems with this command:

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

  1. Set these environment variables for your AWS access credentials:
bash
export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key

Alternatively, you can place the credentials in a file at ~/.aws/credentials or puppetlabs_aws_credentials.ini in the Puppet confdir ('$settings::confdir') based on the following template:

bash
[default]
aws_access_key_id = your_access_key_id
aws_secret_access_key = your_secret_access_key

If you have Puppet running on AWS, and you're running the module examples, you can instead use IAM. To do this, assign the correct role to the instance from which you're running the examples. For a sample profile with all the required permissions, see the IAM profile example.

  1. Finally, install the module with:
bash
puppet module install puppetlabs-aws

A note on regions

By default the module looks through all regions in AWS when determining if something is available. This can be a little slow. If you know what you're doing you can speed things up by targeting a single region using an environment variable.

bash
export AWS_REGION=eu-west-1

A note on proxies

By default the module accesses the AWS API directly, but if you're in an environment that doesn't have direct access you can provide a proxy setting for all traffic like so:

bash
export PUPPET_AWS_PROXY=http://localhost:8888

Configuring the aws module using an ini file

The AWS region and HTTP proxy can be provided in a file called 'puppetlabs_aws_configuration.ini' in the Puppet confdir ('$settings::confdir') using this format:

ini
    [default]
      region = us-east-1
      http_proxy = http://proxy.example.com:80

Usage

Creating resources

You can set up EC2 instances with a variety of AWS features, as well as a VPC, security group, and load balancer.

Setup a VPC:

puppet
ec2_vpc { 'name-of-vpc':
  ensure     => present,
  region     => 'us-east-1',
  cidr_block => '10.0.0.0/24',
  tags       => {
    tag_name => 'value',
  },
}

Setup a subnet:

puppet
ec2_vpc_subnet { 'name-of-subnet':
  ensure                  => present,
  region                  => 'us-east-1',
  cidr_block              => '10.0.0.0/24',
  availability_zone       => 'us-east-1a',
  map_public_ip_on_launch => true,
  vpc                     => 'name-of-vpc,
  tags                    => {
    tag_name => 'value',
  },
}

Setup a security group:

puppet
ec2_securitygroup { 'name-of-security-group':
  ensure      => present,
  region      => 'us-east-1',
  vpc         => 'name-of-vpc',
  description => 'a description of the group',
  ingress     => [{
    protocol  => 'tcp',
    port      => 22,
    cidr      => '0.0.0.0/0',
  }],
  tags        => {
    tag_name  => 'value',
  },
}

Setup an instance:

…

Setup a load balancer:

…

To destroy any of these resources, set ensure => absent.

Managing resources from the command line

The module has basic puppet resource support, so you can manage AWS resources from the command line.

For example, the following command lists all the security groups:

bash
puppet resource ec2_securitygroup

You can also create new resources:

bash
puppet resource ec2_securitygroup test-group ensure=present description="test description" region=us-east-1

and then destroy them, all from the command line:

bash
puppet resource ec2_securitygroup test-group ensure=absent region=sa-east-1

Managing AWS infrastructure

You can use the aws module to audit AWS resources, launch autoscaling groups in VPC, perform unit testing, and more. The examples directory in the module contains a variety of usage examples that should give you an idea of what's possible:

  • Puppet Enterprise: Start up a small Puppet Enterprise cluster using the AWS module.
  • Managing DNS: Manage DNS records in Amazon Route53 using Puppet.
  • Data Driven Manifests: Automatically generate resources based on a data structure.
  • Hiera Example: Store common information like region or AMI id in Hiera.
  • Infrastructure as YAML: Describe an entire infrastructure stack in YAML, and use create_resources and Hiera to build your infrastructure.
  • Auditing Resources: Audit AWS resource changes and work alongside other tools.
  • Unit Testing: Test your AWS code with Puppet testing tools like rspec-puppet.
  • Virtual Private Cloud: Use the Puppet DSL to manage a AWS VPC environment.
  • Using IAM permissions: Control the API permissions required by the module with an IAM profile.
  • Elastic IP Addresses: Attach existing elastic IP addresses to instances managed by Puppet.
  • Create your own abstractions: Use Puppet's defined types to better model your own infrastructure.
  • Distribute instances across availability zones: Use the future parser and stdlib functions to launch instances balanced across different availability zones.

Reference

Types

  • cloudformation_stack: Create, update, or destroy a CloudFormation Stack.
  • cloudfront_distribution: Sets up a CloudFront distribution.
  • ec2_instance: Sets up an EC2 instance.
  • ec2_securitygroup: Sets up an EC2 security group.
  • ec2_volume: Sets up an EC2 EBS volume.
  • elb_loadbalancer: Sets up an ELB load balancer.
  • cloudwatch_alarm: Sets up a Cloudwatch Alarm.
  • ec2_autoscalinggroup: Sets up an EC2 auto scaling group.
  • ec2_elastic_ip: Sets up an Elastic IP and its association.
  • ec2_launchconfiguration: Sets up an EC2 launch configuration to provide autoscaling support.
  • ec2_scalingpolicy: Sets up an EC2 scaling policy.
  • ec2_vpc: Sets up an AWS VPC.
  • ec2_vpc_customer_gateway: Sets up an AWS VPC customer gateway.
  • ec2_vpc_dhcp_options: Sets a DHCP option AWS VPC.
  • ec2_vpc_internet_gateway: Sets up an EC2 VPC Internet Gateway.
  • ec2_vpc_routetable: Sets up a VPC route table.
  • ec2_vpc_subnet: Sets up a VPC subnet.
  • ec2_vpc_vpn: Sets up an AWS Virtual Private Network.
  • ec2_vpc_vpn_gateway: Sets up a VPN gateway.
  • ecs_cluster: Manage an Ec2 Container Service cluster.
  • ecs_service: Manage an Ec2 Container Service service.
  • ecs_task_definition: Manage an Ec2 Container Service task definition.
  • iam_group: Manage IAM groups and their membership.
  • iam_instance_profile: Manage IAM instance profiles.
  • iam_policy: Manage an IAM 'managed' policy.
  • iam_policy_attachment: Manage an IAM 'managed' policy attachments.
  • iam_role: Manage an IAM role.
  • iam_user: Manage IAM users.
  • kms: Manage KMS keys and their policies.
  • rds_db_parameter_group: Allows read access to DB Parameter Groups.
  • rds_db_securitygroup: Sets up an RDS DB Security Group.
  • rds_db_subnet_group: Sets up an RDS DB Subnet Group.
  • rds_instance: Sets up an RDS Database instance.
  • route53_a_record: Sets up a Route53 DNS record.
  • route53_aaaa_record: Sets up a Route53 DNS AAAA record.
  • route53_cname_record: Sets up a Route53 CNAME record.
  • route53_mx_record: Sets up a Route53 MX record.
  • route53_ns_record: Sets up a Route53 DNS record.
  • route53_ptr_record: Sets up a Route53 PTR record.
  • route53_spf_record: Sets up a Route53 SPF record.
  • route53_srv_record: Sets up a Route53 SRV record.
  • route53_txt_record: Sets up a Route53 TXT record.
  • route53_zone: Sets up a Route53 DNS zone.
  • s3_bucket: Sets up an S3 bucket.
  • sqs_queue: Sets up an SQS queue.

Parameters

Type: cloudformation_stack

capabilities

Optional.

The list of stack capabilities.

Valid values are: 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', an empty list, or unspecified.

change_set_id

Read-only.

Unique identifier of the stack.

creation_time

Read-only.

The time at which the stack was created.

description

Read-only.

A user-defined description found in the cloud formation template associated with the stack.

disable_rollback

Optional.

Whether to disable rollback on stack creation failures.

Valid values are: true, false.

ensure

Required.

The ensure value for the stack.

'present' will create the stack but not apply updates.

'updated' will create or apply any updates to the stack.

'absent' will delete the stack.

Valid values are: 'present', 'updated', 'absent'.

id

Read-only.

The unique ID of the stack.

last_updated_time

Read-only.

The time the stack was last updated.

name

Required.

The name of the stack.

`notification

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubydscmodulepowershellpuppet

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言