aws_elastic_lb & aws_elastic_ip
aws_elastic_lb
elastic_lb
handles registering and removing nodes from ELBs. The resource also adds basic support for creating and deleting ELBs. Note that currently this resource is not fully idempotent so it will not update the existing configuration of an ELB.
Actions
register
- Add a node to the ELBderegister
- Remove a node from the ELBcreate
- Create a new ELBdelete
- Delete an existing ELB
Properties
aws_secret_access_key
,aws_access_key
and optionallyaws_session_token
- required, unless using IAM roles for authentication.name
- the name of the ELB, required.region
, The region of the ELB. Defaults to the region of the node.listeners
, Array or hashes. The ports/protocols the ELB will listen on. See the example for a sample.security_groups
, Array. Security groups to apply to the ELB. Only needed when creating ELBs.subnets
, Array. The subnets the ELB will listen in. Only needed when creating ELBs and when using VPCs.availability_zones
: Array. The availability zones the ELB will listen in. Only needed when creating ELBs and when using classic networking.tags
: Array.scheme
: Array.
Examples
ELB running in classic networking listening on port 80.
aws_elastic_lb 'Setup the ELB' do
name 'example-elb'
action :create
availability_zones ['us-west-2a']
listeners [
{
instance_port: 80,
instance_protocol: 'HTTP',
load_balancer_port: 80,
protocol: 'HTTP',
},
]
end
To register the node in the ‘QA’ ELB:
aws_elastic_lb 'elb_qa' do
name 'QA'
action :register
end
aws_elastic_ip
The elastic_ip
resource provider does not support allocating new IPs. This must be done before running a recipe that uses the resource. After allocating a new Elastic IP, we recommend storing it in a databag and loading the item in the recipe.
Actions
associate
- Associate an allocated IP to the nodedisassociate
- Disassociate an allocated IP from the node
Properties
aws_secret_access_key
,aws_access_key
and optionallyaws_session_token
- required, unless using IAM roles for authentication.ip
: String. The IP address to associate or disassociate.timeout
: Integer. Default: 180. Time in seconds to wait. 0 for unlimited.
Examples
aws_elastic_ip '34.15.30.10' do
action :associate
endaws_elastic_ip 'Server public IP' do
ip '34.15.30.11'
action :associate
end