Attach an ec2 instance on the existing ELB


#1

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2 plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have one
very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :
http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


#2

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2 plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have one
very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :
http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


#3

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to register
my ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is
not supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have one
very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


#4

Ohai,

What is the goal here? Are you trying to set up something for autoscaling? Or are you just looking to register new nodes with an ELB?

If you’re doing autoscaling, I’d consider building a custom AMI for the nodes that need to autoscale. I’d make that with the validation.pem and JSON with the run list for the nodes you want, and also sets up chef-client to run at launch or as a service.

If you just want to add nodes to an ELB, Opscode’s “aws” cookbook has an elastic_lb resource, which you could use in your own cookbook. I’d assign the ELB name as an attribute in the role for the node’s in the role you want to use, and then reference that attribute in the resource.

aws_elastic_lb 'my-load-balancer' do
  name node['aws']['load_balancer']
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
end

On May 28, 2013, at 7:27 AM, Chandan Maheshwari cmaheshwari16@gmail.com wrote:

I want to attach an ec2 instance, once it is created using knife ec2 plugin and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have one very good solution to this, thanks to Ivan [which is working fine and creating the instances, attaching them to the ELB I provide] :
http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually install chef-client and dependencies)


#5

Chandan,

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:

I suspect is has to do with the case of ELB and VPC combination, and
hopefully sometime that will get merged in and released, irrespective
of Chef.

-M

On Tue, May 28, 2013 at 11:57 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to register my
ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is not
supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have one
very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


#6

Ohai,

What is the goal here? Are you trying to set up something for autoscaling?
Or are you just looking to register new nodes with an ELB?

                           I wanted to set up for autoscaling only.

What is the difference b/w , “register a newly created node to ELB” vs
setup for autoscaling.

  • If you’re doing autoscaling, I’d consider building a custom AMI for the
    nodes that need to autoscale. I’d make that with the validation.pem and
    JSON with the run list for the nodes you want, and also sets up chef-client
    to run at launch or as a service.
  •                            Sorry but I didn't get actually the way to
    

create AMI, also does it make any difference if every time I trigger to use
basic AMI and then apply my cookbooks on them and then register them again
to the ELB vs just use the AMI with runlist set as JSON and chef-client to
run as a service [except it would be a faster way]

If you just want to add nodes to an ELB, Opscode’s “aws” cookbook has an
elastic_lb resource, which you could use in your own cookbook. I’d assign
the ELB name as an attribute in the role for the node’s in the role you
want to use, and then reference that attribute in the resource.

aws_elastic_lb 'my-load-balancer' do
  name node['aws']['load_balancer']
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
end

                            I used that but it gives me below error:
               " Suppose my ELB is NAME
                  cookbook having recipe to register instance is

cookbook_name

*FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is
not supported in this version of API. Please try 2011-11-15 or newer."

On Tue, May 28, 2013 at 9:34 PM, Mike miketheman@gmail.com wrote:

Chandan,

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
https://github.com/rightscale/right_aws/issues/146

I suspect is has to do with the case of ELB and VPC combination, and
hopefully sometime that will get merged in and released, irrespective
of Chef.

-M

On Tue, May 28, 2013 at 11:57 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to
register my
ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is
not
supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have
one

very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


#7

Hi Mike,
Thanks for pointing this out:

That looks to be a bug with the right_aws gem that the aws cookbook depends
on, and there is an open issue here:
When can we expect it to get solved.

Is there any other way of doing this.

On Tue, May 28, 2013 at 9:44 PM, Chandan Maheshwari <cmaheshwari16@gmail.com

wrote:

Ohai,

What is the goal here? Are you trying to set up something for
autoscaling? Or are you just looking to register new nodes with an ELB?

                           I wanted to set up for autoscaling only.

What is the difference b/w , “register a newly created node to ELB” vs
setup for autoscaling.

  • If you’re doing autoscaling, I’d consider building a custom AMI for the
    nodes that need to autoscale. I’d make that with the validation.pem and
    JSON with the run list for the nodes you want, and also sets up chef-client
    to run at launch or as a service.
  •                            Sorry but I didn't get actually the way
    

to create AMI, also does it make any difference if every time I trigger to
use basic AMI and then apply my cookbooks on them and then register them
again to the ELB vs just use the AMI with runlist set as JSON and
chef-client to run as a service [except it would be a faster way]

If you just want to add nodes to an ELB, Opscode’s “aws” cookbook has an
elastic_lb resource, which you could use in your own cookbook. I’d assign
the ELB name as an attribute in the role for the node’s in the role you
want to use, and then reference that attribute in the resource.

aws_elastic_lb 'my-load-balancer' do
  name node['aws']['load_balancer']
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
end

                            I used that but it gives me below error:
               " Suppose my ELB is NAME

                  cookbook having recipe to register instance is

cookbook_name

*FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is
not supported in this version of API. Please try 2011-11-15 or newer."

On Tue, May 28, 2013 at 9:34 PM, Mike miketheman@gmail.com wrote:

Chandan,

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
https://github.com/rightscale/right_aws/issues/146

I suspect is has to do with the case of ELB and VPC combination, and
hopefully sometime that will get merged in and released, irrespective
of Chef.

-M

On Tue, May 28, 2013 at 11:57 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to
register my
ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC
is not
supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I have
one

very good solution to this, thanks to Ivan [which is working fine and
creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


#8

Mike, What I meant by the “Other way” is any other cookbook or replacement
of gem right_aws.

It seems to be standard cookbook, Joshua also recommended me “aws” cookbook
only.

On Tue, May 28, 2013 at 9:46 PM, Chandan Maheshwari <cmaheshwari16@gmail.com

wrote:

Hi Mike,
Thanks for pointing this out:

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
When can we expect it to get solved.

Is there any other way of doing this.

On Tue, May 28, 2013 at 9:44 PM, Chandan Maheshwari <
cmaheshwari16@gmail.com> wrote:

Ohai,

What is the goal here? Are you trying to set up something for
autoscaling? Or are you just looking to register new nodes with an ELB?

                           I wanted to set up for autoscaling only.

What is the difference b/w , “register a newly created node to ELB” vs
setup for autoscaling.

  • If you’re doing autoscaling, I’d consider building a custom AMI for
    the nodes that need to autoscale. I’d make that with the validation.pem and
    JSON with the run list for the nodes you want, and also sets up chef-client
    to run at launch or as a service.
  •                            Sorry but I didn't get actually the way
    

to create AMI, also does it make any difference if every time I trigger to
use basic AMI and then apply my cookbooks on them and then register them
again to the ELB vs just use the AMI with runlist set as JSON and
chef-client to run as a service [except it would be a faster way]

If you just want to add nodes to an ELB, Opscode’s “aws” cookbook has an
elastic_lb resource, which you could use in your own cookbook. I’d assign
the ELB name as an attribute in the role for the node’s in the role you
want to use, and then reference that attribute in the resource.

aws_elastic_lb 'my-load-balancer' do
  name node['aws']['load_balancer']
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
end

                            I used that but it gives me below error:
               " Suppose my ELB is NAME

                  cookbook having recipe to register instance is

cookbook_name

*FATAL: RightAws::AwsError: aws_elastic_lb[NAME]
(cookbook_name::register line 3) had an error: RightAws::AwsError:
ValidationError: ELB in VPC is not supported in this version of API. Please
try 2011-11-15 or newer."

On Tue, May 28, 2013 at 9:34 PM, Mike miketheman@gmail.com wrote:

Chandan,

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
https://github.com/rightscale/right_aws/issues/146

I suspect is has to do with the case of ELB and VPC combination, and
hopefully sometime that will get merged in and released, irrespective
of Chef.

-M

On Tue, May 28, 2013 at 11:57 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to
register my
ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME]
(cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC
is not
supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I
have one

very good solution to this, thanks to Ivan [which is working fine
and

creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and
manually

install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


#9

When can we expect it to get solved.
Whenever RightScale gem maintainers decide to merge and release.
Chef-related community have no input, other than “if this affects you,
go mention it on the pull request”.

Is there any other way of doing this.
Since you’re using ELB and VPC, you may have to do something yourself.
You might want to look further into the Fog gem, since this is pretty
up-to-date with most of the APIs in use.
http://fog.io/

There’s also The AWS-released SDK for Ruby that might be able to do the same.
http://aws.amazon.com/sdkforruby/

Your mileage may vary, these are all simply suggestions of API tools in ruby.
-M

On Tue, May 28, 2013 at 12:37 PM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Mike, What I meant by the “Other way” is any other cookbook or replacement
of gem right_aws.

It seems to be standard cookbook, Joshua also recommended me “aws” cookbook
only.

On Tue, May 28, 2013 at 9:46 PM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi Mike,
Thanks for pointing this out:

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
When can we expect it to get solved.

Is there any other way of doing this.

On Tue, May 28, 2013 at 9:44 PM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Ohai,

What is the goal here? Are you trying to set up something for
autoscaling? Or are you just looking to register new nodes with an ELB?

                           I wanted to set up for autoscaling only.

What is the difference b/w , “register a newly created node to ELB” vs setup
for autoscaling.

If you’re doing autoscaling, I’d consider building a custom AMI for the
nodes that need to autoscale. I’d make that with the validation.pem and JSON
with the run list for the nodes you want, and also sets up chef-client to
run at launch or as a service.

                             Sorry but I didn't get actually the way

to create AMI, also does it make any difference if every time I trigger to
use basic AMI and then apply my cookbooks on them and then register them
again to the ELB vs just use the AMI with runlist set as JSON and
chef-client to run as a service [except it would be a faster way]

If you just want to add nodes to an ELB, Opscode’s “aws” cookbook has an
elastic_lb resource, which you could use in your own cookbook. I’d assign
the ELB name as an attribute in the role for the node’s in the role you want
to use, and then reference that attribute in the resource.

aws_elastic_lb 'my-load-balancer' do
  name node['aws']['load_balancer']
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
end

                            I used that but it gives me below error:
               " Suppose my ELB is NAME

                  cookbook having recipe to register instance is

cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME] (cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC is not
supported in this version of API. Please try 2011-11-15 or newer."

On Tue, May 28, 2013 at 9:34 PM, Mike miketheman@gmail.com wrote:

Chandan,

That looks to be a bug with the right_aws gem that the aws cookbook
depends on, and there is an open issue here:
https://github.com/rightscale/right_aws/issues/146

I suspect is has to do with the case of ELB and VPC combination, and
hopefully sometime that will get merged in and released, irrespective
of Chef.

-M

On Tue, May 28, 2013 at 11:57 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Thanks Mike for your prompt response.

I was just looking on the same cookbook and wrote once recipe(to
register my
ec2 instance), but it gave me error
Suppose,

my ELB is NAME
cookbook having recipe to register instance is cookbook_name

FATAL: RightAws::AwsError: aws_elastic_lb[NAME]
(cookbook_name::register
line 3) had an error: RightAws::AwsError: ValidationError: ELB in VPC
is not
supported in this version of API. Please try 2011-11-15 or newer.

On Tue, May 28, 2013 at 9:24 PM, Mike miketheman@gmail.com wrote:

Chandan,

You might want to look at the aws cookbook:
http://community.opscode.com/cookbooks/aws

For example, to register the node in the ‘QA’ ELB:

aws_elastic_lb “elb_qa” do
aws_access_key aws[‘aws_access_key_id’]
aws_secret_access_key aws[‘aws_secret_access_key’]
name "QA"
action :register
end

-M

On Tue, May 28, 2013 at 9:27 AM, Chandan Maheshwari
cmaheshwari16@gmail.com wrote:

Hi All,

I want to attach an ec2 instance, once it is created using knife
ec2
plugin
and after applying my runlist to it, to the existing ELB I have.

How can I do this, is there any ready cookbook/LWRP for this. I
have one
very good solution to this, thanks to Ivan [which is working fine
and
creating the instances, attaching them to the ELB I provide] :

http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/

but I don’t want to create instance without using knife (and
manually
install chef-client and dependencies)


Thanks and Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


Regards,
Chandan


#10

On Tue, May 28, 2013 at 9:16 AM, Chandan Maheshwari <cmaheshwari16@gmail.com

wrote:

Is there any other way of doing this.

Yes – consider not doing it at all. While there may be valid reasons for
taking this approach, I think it might be worthwhile to reevaluate the
problem and see if you really need to use chef to manage your ELBs.

An alternative is to associate the ELB with the AS group, so that nodes
automatically register. Use a robust health check @ the ELB so that nodes
aren’t routed traffic unless they can serve the requests successfully.
(You’ll want a good health check anyways so when things go bump in the
cloud, unhealthy nodes aren’t attempting to serve requests. )

I’ve had tens of thousands of instances go through this life-cycle and it
works quite well.

AWS’s tooling here is good and battle-tested. It seems that Chef’s might
not be. If it hurts to use your configuration management framework to
manage your ELBs, perhaps you shouldn’t do that.

There’s also probably an argument to be made that introducing Chef as an
actor in AS/ELB introduces some complexity around fate sharing that can be
problematic if not done carefully.

-n


#11

Thanks Nick,

But I tried to search on AWS console and didn’t found any way of
attaching/associate AS with ELB. I then found a command line tool for
autoscaling. Is this the same you are referring to use. In that case I have
some doubts, as I have not used them much :

  1. Can you please explain how to create AS group.
  2. After step 1) how can I associate ELB with the AS group, again is it one
    time activity?
  3. How the first instance (ec2 created using knife), will be associate with
    AS group or ELB?
  4. Once the step 2 is done (AS is now associated with ELB), how the new
    nodes created (ec2 instances) will automatically have the AS group. I cant
    find any option with knife ec2 server create.

Chandan

On Wed, May 29, 2013 at 11:21 AM, nick hatch nicholas.hatch@gmail.comwrote:

On Tue, May 28, 2013 at 9:16 AM, Chandan Maheshwari <
cmaheshwari16@gmail.com> wrote:

Is there any other way of doing this.

Yes – consider not doing it at all. While there may be valid reasons for
taking this approach, I think it might be worthwhile to reevaluate the
problem and see if you really need to use chef to manage your ELBs.

An alternative is to associate the ELB with the AS group, so that nodes
automatically register. Use a robust health check @ the ELB so that nodes
aren’t routed traffic unless they can serve the requests successfully.
(You’ll want a good health check anyways so when things go bump in the
cloud, unhealthy nodes aren’t attempting to serve requests. )

I’ve had tens of thousands of instances go through this life-cycle and it
works quite well.

AWS’s tooling here is good and battle-tested. It seems that Chef’s might
not be. If it hurts to use your configuration management framework to
manage your ELBs, perhaps you shouldn’t do that.

There’s also probably an argument to be made that introducing Chef as an
actor in AS/ELB introduces some complexity around fate sharing that can be
problematic if not done carefully.

-n


Regards,
Chandan


#12

Hi,

I am able to create AS config and then AS group and then create instances
in AS group which in turn gets attached to ELB. But that is all using
command line tool that I took from :
http://aws.amazon.com/developertools/2535

In this case following
http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/ it
is doing the job. But in this case steps like creation of instance,
chef-client installation, registering to chef-server, running run_list, is
performed using user-data script. I am basically not using knife-ec2 plugin.

How can I achieve those tasks pointed in my last email(creation of AS group
and then attaching it to ELB), using knife-ec2 plugin or using some other
API cooking inside my cookbook/recipe.

Is there any API or gem like right_aws? [which may support ELB and VPC both]

On Wed, May 29, 2013 at 1:33 PM, Chandan Maheshwari <cmaheshwari16@gmail.com

wrote:

Thanks Nick,

But I tried to search on AWS console and didn’t found any way of
attaching/associate AS with ELB. I then found a command line tool for
autoscaling. Is this the same you are referring to use. In that case I have
some doubts, as I have not used them much :

  1. Can you please explain how to create AS group.
  2. After step 1) how can I associate ELB with the AS group, again is it
    one time activity?
  3. How the first instance (ec2 created using knife), will be associate
    with AS group or ELB?
  4. Once the step 2 is done (AS is now associated with ELB), how the new
    nodes created (ec2 instances) will automatically have the AS group. I cant
    find any option with knife ec2 server create.

Chandan

On Wed, May 29, 2013 at 11:21 AM, nick hatch nicholas.hatch@gmail.comwrote:

On Tue, May 28, 2013 at 9:16 AM, Chandan Maheshwari <
cmaheshwari16@gmail.com> wrote:

Is there any other way of doing this.

Yes – consider not doing it at all. While there may be valid reasons
for taking this approach, I think it might be worthwhile to reevaluate the
problem and see if you really need to use chef to manage your ELBs.

An alternative is to associate the ELB with the AS group, so that nodes
automatically register. Use a robust health check @ the ELB so that nodes
aren’t routed traffic unless they can serve the requests successfully.
(You’ll want a good health check anyways so when things go bump in the
cloud, unhealthy nodes aren’t attempting to serve requests. )

I’ve had tens of thousands of instances go through this life-cycle and it
works quite well.

AWS’s tooling here is good and battle-tested. It seems that Chef’s might
not be. If it hurts to use your configuration management framework to
manage your ELBs, perhaps you shouldn’t do that.

There’s also probably an argument to be made that introducing Chef as an
actor in AS/ELB introduces some complexity around fate sharing that can be
problematic if not done carefully.

-n


Regards,
Chandan


Chandan Maheshwari,
Cloud Softwate Engineer, Clogeny Technologies,
http://clogeny.com
(M) 0091-8956541752
Skype: chandan.maheshwari16


#13

I would look at elasticbeanstalk if it can support your needs; integrating
chef with EB makes things easy to manage and Amazon does the heavy lifting
on the EC2/ELB side of the equation. Bear in mind you can migrate the
ElasticBeanstalk config to an Ubuntu AMI (that’s what I’m doing for Rosetta
Stone). Not necessarily easily, but doable.

On Thursday, May 30, 2013, Chandan Maheshwari wrote:

Hi,

I am able to create AS config and then AS group and then create instances
in AS group which in turn gets attached to ELB. But that is all using
command line tool that I took from :
http://aws.amazon.com/developertools/2535

In this case following
http://ivan-site.com/2013/02/auto-scaling-on-amazon-ec2-with-opscode-chef/ it
is doing the job. But in this case steps like creation of instance,
chef-client installation, registering to chef-server, running run_list, is
performed using user-data script. I am basically not using knife-ec2 plugin.

How can I achieve those tasks pointed in my last email(creation of AS
group and then attaching it to ELB), using knife-ec2 plugin or using some
other API cooking inside my cookbook/recipe.

Is there any API or gem like right_aws? [which may support ELB and VPC
both]

On Wed, May 29, 2013 at 1:33 PM, Chandan Maheshwari <
cmaheshwari16@gmail.com <javascript:_e({}, ‘cvml’,
‘cmaheshwari16@gmail.com’);>> wrote:

Thanks Nick,

But I tried to search on AWS console and didn’t found any way of
attaching/associate AS with ELB. I then found a command line tool for
autoscaling. Is this the same you are referring to use. In that case I have
some doubts, as I have not used them much :

  1. Can you please explain how to create AS group.
  2. After step 1) how can I associate ELB with the AS group, again is it
    one time activity?
  3. How the first instance (ec2 created using knife), will be associate
    with AS group or ELB?
  4. Once the step 2 is done (AS is now associated with ELB), how the new
    nodes created (ec2 instances) will automatically have the AS group. I cant
    find any option with knife ec2 server create.

Chandan

On Wed, May 29, 2013 at 11:21 AM, nick hatch <nicholas.hatch@gmail.com<javascript:_e({}, ‘cvml’, ‘nicholas.hatch@gmail.com’);>

wrote:

On Tue, May 28, 2013 at 9:16 AM, Chandan Maheshwari <
cmaheshwari16@gmail.com <javascript:_e({}, ‘cvml’,
‘cmaheshwari16@gmail.com’);>> wrote:

Is there any other way of doing this.

Yes – consider not doing it at all. While there may be valid reasons
for taking this approach, I think it might be worthwhile to reevaluate the
problem and see if you really need to use chef to manage your ELBs.

An alternative is to associate the ELB with the AS group, so that nodes
automatically register. Use a robust health check @ the ELB so that nodes
aren’t routed traffic unless they can serve the requests successfully.
(You’ll want a good health check anyways so when things go bump in the
cloud, unhealthy nodes aren’t attempting to serve requests. )

I’ve had tens of thousands of instances go through this life-cycle and
it works quite well.

AWS’s tooling here is good and battle-tested. It seems that Chef’s might
not be. If it hurts to use your configuration management framework to
manage your ELBs, perhaps you shouldn’t do that.

There’s also probably an argument to be made that introducing Chef as an
actor in AS/ELB introduces some complexity around fate sharing that can be
problematic if not done carefully.

-n


Regards,
Chandan


Chandan Maheshwari,
Cloud Softwate Engineer, Clogeny Technologies,
http://clogeny.com
(M) 0091-8956541752
Skype: chandan.maheshwari16

~~ StormeRider ~~

“Every world needs its heroes […] They inspire us to be better than we
are. And they protect from the darkness that’s just around the corner.”

(from Smallville Season 6x1: “Zod”)

On why I hate the phrase “that’s so lame”… http://bit.ly/Ps3uSS