Balancer
Tool to create ELB load balancers with a target group and listener. It's performs similar steps to this AWS Tutorial: Create an Application Load Balancer Using the AWS CLI
Usage
Quick start to creating and destroying a load balancer.
cd project
balancer init --vpc-id vpc-123 --subnets subnet-123 subnet-456 --security-groups sg-123
# edit .balancer/profiles/default.yml to fit your needs
balancer create my-elb
balancer destroy my-elb
Profiles
Balancer has a concept of profiles. Profiles have preconfigured settings like subnets and vpc_id. The params in the profiles are passed to the ruby aws-sdk api calls create_load_balancer
, create_target_group
, and create_listener
:
---
create_load_balancer:
subnets: # at least 2 subnets groups required
- subnet-123
- subnet-345
security_groups: # optional thanks to the automatically created security group by balancer
- sg-123 # additional security groups to use
create_target_group:
# vpc_id is required
vpc_id: vpc-123
# name: ... # automatically named, matches the load balancer name. override here
protocol: HTTP # required
port: 80 # required
create_listener:
protocol: HTTP # required
port: 80 # required, this is is the port that gets open on the security group
Security Groups
Balancer automatically creates a security group with the same name as the elb and opens up the port configured on the listener. To disable this behavior, use the --no-security-group
optional. If you use this option, you must specify you own security group in the profile file, since at least 1 security group is required. By default, the security group opens up 0.0.0.0/0
. If you want to override this use --sg-cdir
, example:
balancer create my-elb --sg-cdir 10.0.0.0/16
When you destroy the ELB like so:
balancer destroy my-elb
Balancer also attempts to destroy the security group if:
- The security group is tagged with the
balancer=my-elb
tag. Balancer automatically adds this tag when creating the ELB. - There are no dependencies on the security group. If there are dependencies the ELB is deleted but the security group is left behind for you to clean up.
Installation
gem install balancer
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am "Add some feature"
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request