jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: Register new instance with existing load balancer
Date Mon, 20 Oct 2014 08:34:26 GMT
Hi Yaron,

To do that you need to directly access the AWS ELB API, as that
functionality is still not supported in the portable load balancer
abstraction provided by the LoadBalancerService (just FTR there is
already feature request to improve that abstraction [1]). You can get
that API in two ways:

You can extract it from the context you already have by doing:

ELBApi api = elb.unwrapApi(ELBApi.class);

or you can create the api directly instead of creating the
LoadBalancerServiceContext (if you're not going to use the portable
LoadBalancerService):

ELBApi api = ContextBuilder.newBuilder("aws-elb").credentials(awsAccessKeyId,
awsSecretKey).buildApi(ELBApi.class);


Once you have the ELBApi, you can register the nodes in the load
balancer as follows:

api.getInstanceApi().registerInstanceWithLoadBalancer(instanceId,
loadBalancerName);


HTH!


I.

[1] https://issues.apache.org/jira/browse/JCLOUDS-483

On 19 October 2014 12:24, Yaron Rosenbaum <yaron.rosenbaum@gmail.com> wrote:
> Hi
>
> I would like to register a newly created instance with an existing load
> balancer.
> My cloud provider is AWS.
>
> Thus far, I was able to get a context (not even sure if this is correct)
> private LoadBalancerServiceContext elb =
> ContextBuilder.newBuilder(“aws-elb").credentials(awsAccessKeyId,awsSecretKey).buildView(LoadBalancerServiceContext.class);
>
> From this, I think I can do:
> elb.getLoadBalancerService().
>
> but there’s no methods for setting nodes to an existing LB, unless I want to
> create a new LoadBalancer (which I don’t)
>
> Thanks
>
> (Y)
>

Mime
View raw message