Example usage for com.amazonaws.services.route53 AmazonRoute53Client AmazonRoute53Client

List of usage examples for com.amazonaws.services.route53 AmazonRoute53Client AmazonRoute53Client

Introduction

In this page you can find the example usage for com.amazonaws.services.route53 AmazonRoute53Client AmazonRoute53Client.

Prototype

AmazonRoute53Client(AwsSyncClientParams clientParams) 

Source Link

Document

Constructs a new client to invoke service methods on Route 53 using the specified parameters.

Usage

From source file:com.carrotgarden.maven.aws.dns.CarrotRoute53.java

License:BSD License

private AmazonRoute53 newClient() {

    final AmazonRoute53 amazonClient = new AmazonRoute53Client(credentials);

    return amazonClient;

}

From source file:com.netflix.bluespar.amazon.security.AmazonClientProvider.java

License:Apache License

public AmazonRoute53 getAmazonRoute53(AmazonCredentials credentials, String region) {
    AmazonRoute53Client amazonRoute53 = new AmazonRoute53Client(credentials.getCredentials());
    if (region != null && region.length() > 0) {
        amazonRoute53.setRegion(Region.getRegion(Regions.fromName(region)));
    }//ww  w  .j ava  2 s  .  c om

    return amazonRoute53;
}

From source file:com.oneops.inductor.AbstractOrderExecutor.java

License:Apache License

/**
 * Gets dns servers//w  ww. jav a2  s .  co  m
 *
 * @param awsCredentials AWSCredentials
 * @param zoneDomainName zoneDomainName
 * @return dns servers
 */
private List<String> getAuthoritativeServersWithAwsCreds(AWSCredentials awsCredentials, String zoneDomainName) {

    if (!zoneDomainName.endsWith(".")) {
        zoneDomainName += ".";
    }

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);
    ListHostedZonesResult result = route53.listHostedZones();
    List<HostedZone> zones = result.getHostedZones();
    List<String> dnsServers = new ArrayList<String>();
    for (int i = 0; i < zones.size(); i++) {
        HostedZone hostedZone = zones.get(i);
        logger.info("zone: " + hostedZone.getName());
        if (hostedZone.getName().equalsIgnoreCase(zoneDomainName)) {
            logger.info("matched zone");
            GetHostedZoneResult zone = route53.getHostedZone(
                    new GetHostedZoneRequest().withId(hostedZone.getId().replace("/hostedzone/", "")));
            DelegationSet delegationSet = zone.getDelegationSet();
            dnsServers = delegationSet.getNameServers();
            break;
        }
    }
    logger.info("dnsServer: " + dnsServers.toString());
    return dnsServers;
}

From source file:com.renatodelgaudio.awsupdate.EnvUtil.java

License:Open Source License

public static AmazonRoute53 buildRoute53(File aws) {
    AmazonRoute53 r53 = null;/*from   ww w  .  j  a  va 2  s .  co m*/
    try {
        r53 = new AmazonRoute53Client(new PropertiesCredentials(aws));
    } catch (Exception e) {
        log.error("Cannot build AmazonRouter53Client", e);
        throw new ConfigurationException(e.getMessage());
    }
    return r53;
}

From source file:edu.umass.cs.aws.support.Route53.java

License:Apache License

/**
 *
 * @param args//from w  w w.j av a2s .c  om
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    AWSCredentials credentials = new PropertiesCredentials(
            AWSEC2.class.getResourceAsStream("resources/AwsCredentials.properties"));
    //Create Amazon Client object
    route53 = new AmazonRoute53Client(credentials);
    listRecordSetsForHostedZone();
}

From source file:fr.xebia.workshop.bigdata.WorkshopInfrastructureCreator.java

License:Apache License

public static void main(String args[]) {

    AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials();
    AmazonEC2 ec2 = new AmazonEC2Client(awsCredentials);
    ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);

    WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure().withTeamIdentifiers("1" /* ,"2"
                                                                                                         * , "3", "4", "5", "6", "7", "8",
                                                                                                         * "9", "10", "11"
                                                                                                         */)
            .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId())
            .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("xte-flume");

    // checks for Key in classpath: prevents launching instances if not
    // present/*www . ja  va2 s .c  o  m*/
    checkKeyFile(workshopInfrastructure);

    AmazonAwsUtils.terminateInstancesByWorkshop("flume-hadoop", ec2);

    ExecutorService executor = Executors.newFixedThreadPool(3);

    //executor.execute(new CreateTomcatServers(ec2, route53,
    //        workshopInfrastructure));

    executor.execute(new CreateHadoopMasterNode(ec2, route53, workshopInfrastructure));

    executor.execute(new CreateHadoopSlaveNode(ec2, route53, workshopInfrastructure));

    executor.shutdown();

    try {
        executor.awaitTermination(10, TimeUnit.MINUTES);
        executor.shutdownNow();
    } catch (Exception e) {
        logger.error(e.getMessage());
    }

    logger.info("Workshop infrastructure created");

}

From source file:fr.xebia.workshop.caching.CreateCachingProxyServers.java

License:Apache License

public static void main(String[] args) {
    AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials();
    AmazonEC2 ec2 = new AmazonEC2Client(awsCredentials);
    ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);

    WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure()
            .withTeamIdentifiers("1", "2", "3"/*, "4", "5", "6", "7", "8", "9", "10", "11"*/)
            .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId())
            .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("web-caching-workshop")
            .withBeanstalkNotificationEmail("cleclerc@xebia.fr");

    CreateCachingProxyServers job = new CreateCachingProxyServers(ec2, route53, workshopInfrastructure);
    job.run();//ww  w  .ja  va  2  s .  c  o  m

}

From source file:fr.xebia.workshop.caching.WorkshopInfrastructureCreator.java

License:Apache License

public static void main(String[] args) {

    // AMAZON SERVICES
    AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials();
    AmazonEC2 ec2 = new AmazonEC2Client(awsCredentials);
    ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");

    AWSElasticBeanstalk beanstalk = new AWSElasticBeanstalkClient(awsCredentials);
    beanstalk.setEndpoint("elasticbeanstalk.eu-west-1.amazonaws.com");

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);

    ExecutorService executor = Executors.newFixedThreadPool(3);

    // WORKSHOP CONFIGURATION
    WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure()
            .withTeamIdentifiers("1", "2" /*, "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" */)
            .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId())
            .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("web-caching-workshop")
            .withBeanstalkNotificationEmail("cleclerc@xebia.fr");

    // CREATE WORKSHOP INFRASTRUCTURE
    CreateCachingProxyServers createCachingProxyServers = new CreateCachingProxyServers(ec2, route53,
            workshopInfrastructure);//  w w  w.jav a 2  s  .c  o  m
    executor.execute(createCachingProxyServers);

    CreateTomcat createTomcat = new CreateTomcat(beanstalk, workshopInfrastructure);
    executor.execute(createTomcat);

    executor.shutdown();

    try {
        executor.awaitTermination(10, TimeUnit.MINUTES);
    } catch (Exception e) {
        e.printStackTrace();
    }

    logger.info("Workshop infrastructure created");
}

From source file:fr.xebia.workshop.nginx.CreateNginxProxyServers.java

License:Apache License

public static void main(String[] args) {
    AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials();
    AmazonEC2 ec2 = new AmazonEC2Client(awsCredentials);
    ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);

    WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure()
            .withTeamIdentifiers("1"/*, "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"*/)
            .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId())
            .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("nginx-workshop")
            .withBeanstalkNotificationEmail("slemesle@xebia.fr");

    CreateNginxProxyServers job = new CreateNginxProxyServers(ec2, route53, workshopInfrastructure);
    job.run();//from   www.  j a v  a 2s. c o m
    /*
    List<Reservation> reservations = ec2.describeInstances(new DescribeInstancesRequest().withInstanceIds("i-7741eb3f")).getReservations();
    Instance instance = Iterables.getOnlyElement(Iterables.getOnlyElement(reservations).getInstances());
            
    Map<String, Instance> instancesByTeamId = Collections.singletonMap("clc", instance);
            
    job.bindInstancesToDnsCnames(instancesByTeamId, route53);
    */

}

From source file:fr.xebia.workshop.nginx.NginxLabCreator.java

License:Apache License

public static void main(String[] args) {

    AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials();
    AmazonEC2 ec2 = new AmazonEC2Client(awsCredentials);
    ec2.setEndpoint("ec2.eu-west-1.amazonaws.com");

    AmazonRoute53 route53 = new AmazonRoute53Client(awsCredentials);

    WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure()
            .withTeamIdentifiers("1"/*, "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"*/)
            .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId())
            .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("nginx-workshop")
            .withBeanstalkNotificationEmail("slemesle@xebia.fr");

    CreateNginxProxyServers job = new CreateNginxProxyServers(ec2, route53, workshopInfrastructure);
    job.run();/* w  ww  . jav a  2s  .  c  o  m*/

    log.info("All Nginx instances created DNS is http://www-nginx-${team}.aws.xebiatechevent.info/");

    CreateTomcatServers tomcatServers = new CreateTomcatServers(ec2, route53, workshopInfrastructure);
    tomcatServers.run();

    log.info(
            "All Tomcat instances created Route53 is http://xfr-cocktail-nginx-${team}.aws.xebiatechevent.info:[8080/8180]/");
}