用于管理 AWS 资源以构建基础架构的 Puppet 模块
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.
The aws module manages Amazon Web Services (AWS) resources to build out cloud infrastructure.
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.
'/opt/puppetlabs/puppet/bin/gem install aws-sdk retries'
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:
[default]
aws_access_key_id = your_access_key_id
aws_secret_access_key = your_secret_access_keyIf 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.
puppet module install puppetlabs-awsBy 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.
export AWS_REGION=eu-west-1By 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:
export PUPPET_AWS_PROXY=http://localhost:8888The 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:
[default]
region = us-east-1
http_proxy = http://proxy.example.com:80You can set up EC2 instances with a variety of AWS features, as well as a VPC, security group, and load balancer.
Setup a VPC:
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:
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:
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.
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:
puppet resource ec2_securitygroupYou can also create new resources:
puppet resource ec2_securitygroup test-group ensure=present description="test description" region=us-east-1and then destroy them, all from the command line:
puppet resource ec2_securitygroup test-group ensure=absent region=sa-east-1You 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:
create_resources and Hiera to build your infrastructure.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.capabilitiesOptional.
The list of stack capabilities.
Valid values are: 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', an empty list, or unspecified.
change_set_idRead-only.
Unique identifier of the stack.
creation_timeRead-only.
The time at which the stack was created.
descriptionRead-only.
A user-defined description found in the cloud formation template associated with the stack.
disable_rollbackOptional.
Whether to disable rollback on stack creation failures.
Valid values are: true, false.
ensureRequired.
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'.
idRead-only.
The unique ID of the stack.
last_updated_timeRead-only.
The time the stack was last updated.
nameRequired.
The name of the stack.
暂无开放 Issues,或尚未同步最近议题。