jclouds-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yaron Rosenbaum <yaron.rosenb...@gmail.com>
Subject Re: Ec2 Load balancer example
Date Mon, 16 Mar 2015 14:23:15 GMT
Nipun,
For what it’s worth:

		<dependency>
			<groupId>org.apache.jclouds.labs</groupId>
			<artifactId>aws-elb</artifactId>
			<version>1.8.0</version>
		</dependency>


	import org.jclouds.elb.ELBApi;

	private synchronized ELBApi getLoadBalancer() {
		if (null == _elb) _elb = ContextBuilder.newBuilder("aws-elb").credentials(getAccount(),
getSecret()).buildApi(ELBApi.class);
		return _elb;
	}

	@Override
	public void addServerToLoadBalancer(ComputeMetadata node, final MetaLocation location) {
		getLoadBalancer().getInstanceApiForRegion(location.getRegion()).registerInstanceWithLoadBalancer(node.getProviderId(),
location.getLoadBalancerName());
	}


	@Override
	public void removeServerFromLoadBalancer(ComputeMetadata node, final MetaLocation location)
{
		getLoadBalancer().getInstanceApiForRegion(location.getRegion()).deregisterInstanceFromLoadBalancer(node.getProviderId(),
location.getLoadBalancerName());
	}

MetaLocation is not a jClouds API, nor is getAccount() and getSecret(), but you get the gist
of it.

Maybe it would be a good idea to add something like this to the wiki.

(Y)

> On Mar 16, 2015, at 9:57 AM, Nipun Udara <y.b.n.udara@gmail.com> wrote:
> 
> Hi all
> 
> Is there any examples for using aws elastic loadbalancer with jclouds
> 
> Regards
> Nipun Udara
> 
> 
> 


Mime
View raw message