List of usage examples for com.amazonaws.auth AWSCredentials getAWSSecretKey
public String getAWSSecretKey();
From source file:fr.xebia.workshop.bigdata.DocumentationGenerator.java
License:Apache License
public static void main(String[] args) { AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials(); WorkshopInfrastructure workshopInfrastructure = new WorkshopInfrastructure() .withTeamIdentifiers("1", "2"/*, "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"*/) .withAwsAccessKeyId(awsCredentials.getAWSAccessKeyId()) .withAwsSecretKey(awsCredentials.getAWSSecretKey()).withKeyPairName("xte-flume"); DocumentationGenerator documentationGenerator = new DocumentationGenerator(); try {//from ww w . ja va2 s. co m documentationGenerator.generateDocs(workshopInfrastructure, "target/wiki/"); } catch (IOException e) { e.printStackTrace(); } }
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// w ww .j a v a2 s.c om 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.j a v a 2s . com }
From source file:fr.xebia.workshop.caching.CreateTomcat.java
License:Apache License
public static void main(String[] args) throws Exception { AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials(); AWSElasticBeanstalk beanstalk = new AWSElasticBeanstalkClient(awsCredentials); beanstalk.setEndpoint("elasticbeanstalk.eu-west-1.amazonaws.com"); 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"); CreateTomcat createTomcat = new CreateTomcat(beanstalk, workshopInfrastructure); createTomcat.createServers();//from ww w . ja v a2 s . c om }
From source file:fr.xebia.workshop.caching.DocumentationGenerator.java
License:Apache License
public static void main(String[] args) { AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials(); 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"); DocumentationGenerator documentationGenerator = new DocumentationGenerator(); try {/*w ww . j ava 2 s. c om*/ documentationGenerator.generateDocs(workshopInfrastructure, "target/wiki/"); } catch (IOException e) { e.printStackTrace(); } }
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);/*from w w w . j a va2 s . c om*/ 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 2 s .com*/ /* 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.CreateTomcat.java
License:Apache License
public static void main(String[] args) throws Exception { AWSCredentials awsCredentials = AmazonAwsUtils.loadAwsCredentials(); AWSElasticBeanstalk beanstalk = new AWSElasticBeanstalkClient(awsCredentials); beanstalk.setEndpoint("elasticbeanstalk.eu-west-1.amazonaws.com"); 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"); CreateTomcat createTomcat = new CreateTomcat(beanstalk, workshopInfrastructure); createTomcat.createServers();//from w ww . j a v a 2 s . c o m }
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();/* ww w. j ava 2 s . c om*/ 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]/"); }
From source file:hudson.plugins.ec2.EC2Cloud.java
License:Open Source License
/** * Computes the presigned URL for the given S3 resource. * * @param path//w w w .j a va 2 s. co m * String like "/bucketName/folder/folder/abc.txt" that represents the resource to request. */ public URL buildPresignedURL(String path) throws AmazonClientException { AWSCredentials credentials = awsCredentialsProvider.getCredentials(); long expires = System.currentTimeMillis() + 60 * 60 * 1000; GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(path, credentials.getAWSSecretKey()); request.setExpiration(new Date(expires)); AmazonS3 s3 = new AmazonS3Client(credentials); return s3.generatePresignedUrl(request); }