List of usage examples for com.amazonaws.auth BasicAWSCredentials BasicAWSCredentials
public BasicAWSCredentials(String accessKey, String secretKey)
From source file:com.metamx.druid.merger.coordinator.http.IndexerCoordinatorNode.java
License:Open Source License
public void initializeTaskRunnerFactory() { if (taskRunnerFactory == null) { if (config.getRunnerImpl().equals("remote")) { taskRunnerFactory = new TaskRunnerFactory() { @Override//from w w w.ja va 2 s.co m public TaskRunner build() { // Don't use scheduledExecutorFactory, since it's linked to the wrong lifecycle (global lifecycle instead // of leadership lifecycle) final ScheduledExecutorService retryScheduledExec = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("RemoteRunnerRetryExec--%d").build()); ScalingStrategy strategy; if (config.getStrategyImpl().equalsIgnoreCase("ec2")) { strategy = new EC2AutoScalingStrategy(jsonMapper, new AmazonEC2Client(new BasicAWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey"))), configFactory.build(EC2AutoScalingStrategyConfig.class), workerSetupManager); } else if (config.getStrategyImpl().equalsIgnoreCase("noop")) { strategy = new NoopScalingStrategy(); } else { throw new ISE("Invalid strategy implementation: %s", config.getStrategyImpl()); } return new RemoteTaskRunner(jsonMapper, configFactory.build(RemoteTaskRunnerConfig.class), curatorFramework, new PathChildrenCache(curatorFramework, indexerZkConfig.getAnnouncementPath(), true), retryScheduledExec, new RetryPolicyFactory(configFactory.build(RetryPolicyConfig.class)), strategy, workerSetupManager); } }; } else if (config.getRunnerImpl().equals("local")) { taskRunnerFactory = new TaskRunnerFactory() { @Override public TaskRunner build() { final ExecutorService runnerExec = Executors .newFixedThreadPool(config.getNumLocalThreads()); return new LocalTaskRunner(taskToolbox, runnerExec); } }; } else { throw new ISE("Invalid runner implementation: %s", config.getRunnerImpl()); } } }
From source file:com.meteotester.util.S3Util.java
License:Open Source License
public static void saveFileToS3(File file) { try {/*w w w. j av a2 s . c o m*/ AWSCredentials myCredentials = new BasicAWSCredentials(Config.AWS_ACCESS_KEY, Config.AWS_SECRET_KEY); AmazonS3 s3client = new AmazonS3Client(myCredentials); s3client.setRegion(Region.getRegion(Regions.EU_WEST_1)); String filename = file.getName(); String path = file.getPath(); PutObjectRequest req = new PutObjectRequest(Config.S3_BUCKETNAME, path, file); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(file.length()); String contentType = (filename.contains("json")) ? "application/json" : "text/csv"; metadata.setContentType(contentType); req.setMetadata(metadata); s3client.putObject(req); log.info(filename + " stored in S3"); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.mimesis.jmx.Exporter4CloudwatchAsyncClient.java
License:Apache License
public Exporter4CloudwatchAsyncClient(Config config) throws Exception { super(config); _awsCredentials = new BasicAWSCredentials(config.getString("cloudwatch.credential.accessKey", null), config.getString("cloudwatch.credential.secretKey", null)); }
From source file:com.MobMonkey.Helpers.SimpleWorkFlow.ConfigHelper.java
License:Open Source License
public AmazonSimpleWorkflow createSWFClient() { AWSCredentials awsCredentials = new BasicAWSCredentials(this.swfAccessId, this.swfSecretKey); AmazonSimpleWorkflow client = new AmazonSimpleWorkflowClient(awsCredentials); client.setEndpoint(this.swfServiceUrl); return client; }
From source file:com.MobMonkey.Helpers.SimpleWorkFlow.ConfigHelper.java
License:Open Source License
public AmazonS3 createS3Client() { AWSCredentials s3AWSCredentials = new BasicAWSCredentials(this.s3AccessId, this.s3SecretKey); AmazonS3 client = new AmazonS3Client(s3AWSCredentials); return client; }
From source file:com.mortardata.pig.storage.DynamoDBStorage.java
License:Apache License
private AmazonDynamoDBClient loadDynamoDB() { if (this.dynamo == null) { this.dynamo = new AmazonDynamoDBClient(new BasicAWSCredentials(this.awsAccessKeyId, this.awsSecretKey)); }//from w w w. ja v a 2 s . c o m return this.dynamo; }
From source file:com.moxtra.S3StorageManager.java
License:Open Source License
/** * Returns a new AmazonS3 client using the default endpoint and current * credentials.// w w w . j ava 2 s .c o m */ public static AmazonS3Client createClient() { AWSCredentials creds = new BasicAWSCredentials(getKey(), getSecret()); //ClientConfiguration cf = new ClientConfiguration(); return new AmazonS3Client(creds); }
From source file:com.mrbjoern.blog.api.configuration.S3Configuration.java
License:Open Source License
@Bean public BasicAWSCredentials basicAWSCredentials() { return new BasicAWSCredentials(accessKeyId, accessKeySecret); }
From source file:com.mulesoft.agent.monitoring.publisher.CloudwatchMonitorPublisher.java
License:Open Source License
@Override public boolean flush(@NotNull Collection<List<Metric>> listOfMetrics) { AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); AmazonCloudWatchAsyncClient cloudWatchClient = new AmazonCloudWatchAsyncClient(credentials); for (List<Metric> metrics : listOfMetrics) { List<MetricDatum> cloudWatchMetrics = transformMetrics(metrics); PutMetricDataRequest putMetricDataRequest = new PutMetricDataRequest(); putMetricDataRequest.setMetricData(cloudWatchMetrics); putMetricDataRequest.setNamespace(namespace); cloudWatchClient.putMetricData(putMetricDataRequest); }/*from w ww .ja v a 2s .c om*/ return true; }
From source file:com.netflix.bdp.s3mper.alert.impl.AlertJanitor.java
License:Apache License
public void initalize(URI uri, Configuration conf) { this.conf = conf; String keyId = conf.get("fs." + uri.getScheme() + ".awsAccessKeyId"); String keySecret = conf.get("fs." + uri.getScheme() + ".awsSecretAccessKey"); //An override option for accessing across accounts keyId = conf.get("fs." + uri.getScheme() + ".override.awsAccessKeyId", keyId); keySecret = conf.get("fs." + uri.getScheme() + ".override.awsSecretAccessKey", keySecret); sqs = new AmazonSQSClient(new BasicAWSCredentials(keyId, keySecret)); //SQS Consistency Queue consistencyQueue = conf.get("fs" + uri.getScheme() + ".alert.sqs.queue", consistencyQueue); consistencyQueue = sqs.getQueueUrl(new GetQueueUrlRequest(consistencyQueue)).getQueueUrl(); //SQS Timeout Queue timeoutQueue = conf.get("fs" + uri.getScheme() + ".timeout.sqs.queue", timeoutQueue); timeoutQueue = sqs.getQueueUrl(new GetQueueUrlRequest(timeoutQueue)).getQueueUrl(); }