autoscaling group not able find and/or attach to elb
Opened this issue · 3 comments
I am getting the following errors when trying to attach autoscaling group to elb
just following same example as the one you have
did you guys test this code?
the error is below
"msg": "Failed to create Autoscaling Group: BotoServerError: 400 Bad Request\n<ErrorResponse xmlns=\"http://autoscaling.amazonaws.com/doc/2011-01-01/\">\n <Error>\n <Type>Sender</Type>\n <Code>ValidationError</Code>\n <Message>Provided Load Balancers may not be valid. Please ensure they exist and try again.</Message>\n </Error>\n <RequestId>bc6fc38e-8dfe-11e7-bbae-d56fd34454</RequestId>\n</ErrorResponse>\n"
checked and the loadbalancer were created and exist and they are fine but i have no idea why the autoscaling group is not able to find them
I think this is an issue with internal
ELB
- name: launch visualizer load balancer
ec2_elb_lb:
name: "{{ vpc }}-{{ region }}-{{ env }}-a"
scheme: internal
state: present
subnets: "{{ subnets | join(',') }}"
security_group_ids: "{{ security_groups }}"
connection_draining_timeout: 60
cross_az_load_balancing: yes
listeners:
- protocol: https
load_balancer_port: 443
instance_port: 9999
ssl_certificate_id: "{{ elb_acm_certificate }}"
health_check:
ping_protocol: http
ping_port: 9009
ping_path: "/status"
response_timeout: 5
interval: 30
unhealthy_threshold: 2
healthy_threshold: 10
- name: launch microservice load balancer
ec2_elb_lb:
name: "{{ vpc }}-{{ region }}-{{ env }}-bi"
scheme: internal
state: present
subnets: "{{ subnets | join(',') }}"
security_group_ids: "{{ security_groups }}"
connection_draining_timeout: 60
cross_az_load_balancing: yes
listeners:
- protocol: https
load_balancer_port: 443
instance_port: 9000
ssl_certificate_id: "{{ elb_acm_certificate }}"
health_check:
ping_protocol: http
ping_port: 9009
ping_path: "/status"
response_timeout: 5
interval: 30
unhealthy_threshold: 2
healthy_threshold: 10
- name: create conductr-haproxy Autoscaling Group
ec2_asg:
name: "{{ cluster_name }}"
availability_zones: "{{ availability_zones }}"
load_balancers: '{{ vpc }}-{{ region }}-{{ env }}-a, {{ vpc }}-{{ region }}-{{ env }}-b'
launch_config_name: "{{ lc_name }}"
min_size: "{{ asg_min_size }}"
max_size: "{{ asg_max_size }}"
desired_capacity: "{{ asg_desired_size }}"
vpc_zone_identifier: "{{ subnets }}"
tags: "{{ tags }}"
state: present
ERROR
"msg": "Failed to create Autoscaling Group: BotoServerError: 400 Bad Request\n<ErrorResponse xmlns=\"http://autoscaling.amazonaws.com/doc/2011-01-01/\">\n <Error>\n <Type>Sender</Type>\n <Code>ValidationError</Code>\n <Message>Provided Load Balancers may not be valid. Please ensure they exist and try again.</Message>\n </Error>\n <RequestId>bc6fc38e-8dfe-11e7-bbae-d56fd34454</RequestId>\n</ErrorResponse>\n"
So since am using internal ELB, is there anything else i need to do?
If you are using an ELB, try attaching the Target-Group associated with the ELB, using "target_group_arns" tag
- name: 'Create Liferay ASG'
ec2_asg:
name: "test-{{env}}-ASG"
target_group_arns: "arn:aws:elasticloadbalancing:us-east-1:395015784255:targetgroup/test-priv-tg/48bc582585fe9ee3"
launch_config_name: "test-{{env}}-launchConfig"
min_size: 0
max_size: 3
desired_capacity: 0
termination_policies: "OldestInstance"
vpc_zone_identifier: [ "subnet_priv_0}}", "{{subnet_priv_1}}", "{{subnet_priv_2}}" ]
replace_all_instances: yes
tags:
- environment: "dev"
propagate_at_launch: no
register: asg_details - debug: var=asg_details
@nsharma070980 I thought with classic load balancers you have to use LoadBalancerNames
key: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-loadbalancernames