Appserver
The load balancer we have created listens on the port 80 and 443 and forwards requests to 9763 and 9443. Say now we need to delete the listeners.
elb-delete-lb-listeners autoscalelb --lb-ports 80 443 -K KEY.pem -C CERT.pem
Warning: Deleting a LoadBalancer listener can lead to service disruption to
any customers connected to the LoadBalancer listener. Are you sure you want
to delete this LoadBalancer listener? [Ny]N
elb-delete-lb-listeners: User stopped the execution of elb-delete-lb-listeners.
(Providing 'N' stops the action. You can proceed deleting the listener, by giving 'y' as the response.) Warning: Deleting a LoadBalancer listener can lead to service disruption to
any customers connected to the LoadBalancer listener. Are you sure you want
to delete this LoadBalancer listener? [Ny]N
elb-delete-lb-listeners: User stopped the execution of elb-delete-lb-listeners.
You can also create more listeners
elb-create-lb-listeners autoscalelb --headers --listener "lb-port=8280,instance-port=9763,protocol=http" --listener "lb-port=8243,instance-port=9443,protocol=tcp" -K KEY.pem -C CERT.pem
OK-Creating LoadBalancer Listener
Now what will happen if you forcefully try to kill the instances initiated by the ELB? It will create one more identical instance immediately, handling the failover case.
Fail over
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling- groups autoscleasg -K KEY.pem -C CERT.pem
Initially,
AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1c autoscalelb 1 10 1
INSTANCE i-xxxxxxxx us-east-1c InService Healthy autoscalelc
When we killed the instance.
AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1c autoscalelb 1 10 1
INSTANCE i-xxxxxxxx us-east-1c Terminating Unhealthy autoscalelc
INSTANCE i-yyyyyyyy us-east-1c Pending Healthy autoscalelc
After a few seconds,
AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1c autoscalelb 1 10 1
INSTANCE i-yyyyyyyy us-east-1c InService Healthy autoscalelc
Sounds cool.. So how to terminate the instances that ELB creates?
Shall we try deleting?
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem
Are you sure you want to delete this AutoScalingGroup? [Ny]y
as-delete-auto-scaling-group: Service error: You cannot delete an AutoScalingGroup while there are instances
still in the group. AWSRequestId:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa
Min = Max = 0
ok! So let's stop auto-scaling process by setting the minimum and maximum to zero.
pradeeban@pradeeban:~/pem$ as-update-auto-scaling-group autoscleasg --min-size 0 --max-size 0 -K KEY.pem -C CERT.pem
OK-Updated AutoScalingGroup
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling-groups autoscleasg -K KEY.pem -C CERT.pem
AUTO-SCALING-GROUP autoscleasg autoscalelc us-east-1c autoscalelb 0 0 0
INSTANCE i-yyyyyyyy us-east-1c InService Healthy autoscalelc
Delete
Now let's try to delete the auto-scaling group once more -- yes, as we have set it to zero, it should be possible now.
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem
Are you sure you want to delete this AutoScalingGroup? [Ny]y
as-delete-auto-scaling-group: Service error: You cannot delete an AutoScalingGroup while there are scaling activities in progress for that group.
AWSRequestId:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbb
oh.. Let's wait a minute for that scaling down activity to finish!
Again!
pradeeban@pradeeban:~/pem$ as-delete-auto-scaling-group autoscleasg -K KEY.pem -C CERT.pem
Are you sure you want to delete this AutoScalingGroup? [Ny]y
OK-Deleted AutoScalingGroup
Done!
Now, let's check once more whether we have deleted it properly.. ;)
pradeeban@pradeeban:~/pem$ as-describe-auto-scaling- groups autoscleasg -K KEY.pem -C CERT.pem
No AutoScalingGroups found
Yes, we have deleted the Amazon ELB along with the scaling group of nodes it created. (We are sinners! ;))
Format the syntax/code lines kapes! <3
ReplyDeleteThanks for the suggestion Sachoo; will do.. :)
ReplyDelete