List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient
AmazonDynamoDBClient(AwsSyncClientParams clientParams)
From source file:com.app.dynamoDb.DynamoUserAuthority.java
License:Open Source License
/** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration *//* w ww . ja va2 s.c o m*/ private static void init() throws Exception { /* * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (C:\\Users\\yogeshrawat\\.aws\\credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (C:\\Users\\yogeshrawat\\.aws\\credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); }
From source file:com.aws.sampleImage.url.LambdaFunctionImageURLCrawlerHandler.java
private static void init() { AWSCredentials awsCredentials = new AWSCredentials() { @Override//from www. j av a 2 s . com public String getAWSSecretKey() { return "M2HnD68DXBmeNYcuxO0PDVuRPjJONDLiRXTFwygN";//M2HnD68DXBmeNYcuxO0PDVuRPjJONDLiRXTFwygN } @Override public String getAWSAccessKeyId() { return "AKIAJ5LSYQCPXHSNYVYQ";//AKIAJ5LSYQCPXHSNYVYQ } }; //dynamoDB = new AmazonDynamoDBClient(new EnvironmentVariableCredentialsProvider()); dynamoDB = new AmazonDynamoDBClient(awsCredentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); System.out.println("^^^^^ DynamoDB created successfully --> " + dynamoDB); }
From source file:com.boundary.aws.dynamodb.QueryDynamoDB.java
License:Open Source License
/** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration *///w w w. j av a 2s .co m private static void init() throws Exception { /* * The ProfileCredentialsProvider will return your [default] credential * profile by reading from the credentials file located at * (/Users/davidg/.aws/credentials). */ AWSCredentials credentials = null; try { credentials = new ProfileCredentialsProvider("default").getCredentials(); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file." + e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usWest1 = Region.getRegion(Regions.US_WEST_1); dynamoDB.setRegion(usWest1); }
From source file:com.cfelde.aws.ddb.management.TableThroughput.java
License:Open Source License
public static void main(String... args) { loadPartitionState();//from w ww .java 2 s . c o m // TODO: All these parameters should be loaded from a config file! String accessKey = "YOUR ACCESS KEY"; String secretKey = "YOUR SECRET KEY"; AmazonCloudWatch client = new AmazonCloudWatchClient(new BasicAWSCredentials(accessKey, secretKey)); AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(new BasicAWSCredentials(accessKey, secretKey)); client.setEndpoint("https://monitoring.eu-west-1.amazonaws.com"); ddb.setEndpoint("https://dynamodb.eu-west-1.amazonaws.com"); // Do one per table you want to manage initTableThroughput(client, ddb, "table1", 2, 100, 2, 100); initTableThroughput(client, ddb, "table2", 2, 100, 2, 100); executor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { storePartitionState(); } }, 16, 61, TimeUnit.MINUTES); }
From source file:com.clicktravel.infrastructure.runtime.config.aws.AwsConfiguration.java
License:Apache License
@Bean @Autowired// w ww. ja va 2 s .c o m public AmazonDynamoDB amazonDynamoDbClient(final AWSCredentials awsCredentials, @Value("${aws.dynamodb.client.endpoint}") final String endpoint) { final AmazonDynamoDB amazonDynamoDbClient = new AmazonDynamoDBClient(awsCredentials); logger.info("Setting AWS DynamoDB endpoint to: " + endpoint); amazonDynamoDbClient.setEndpoint(endpoint); return amazonDynamoDbClient; }
From source file:com.climate.oada.dao.impl.DynamodbDAO.java
License:Open Source License
/** * Init method to intialize AWS credentials. * * @throws Exception in case of error./*ww w .ja v a 2 s .co m*/ */ public void init() throws Exception { AWSCredentials credentials = new PropertiesCredentials( AmazonDynamoDB.class.getResourceAsStream("AwsCredentials.properties")); dynamoDB = new AmazonDynamoDBClient(credentials); }
From source file:com.cloudkon.remote.worker.Dynamodb.java
License:Open Source License
/** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration *//*from www . ja va 2 s . c o m*/ public static void init() { /* * Load the credentials */ AWSCredentials credentials = null; try { //InputStream credentialsFile = Dynamodb.class.getResourceAsStream("awsSecuCredentials.properties"); InputStream credentialsFile = new FileInputStream("./awsSecuCredentials.properties"); credentials = new PropertiesCredentials(credentialsFile); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential file. ", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usEast1 = Region.getRegion(Regions.US_EAST_1); dynamoDB.setRegion(usEast1); }
From source file:com.dell.doradus.db.dynamodb.DynamoDBService.java
License:Apache License
public DynamoDBService(Tenant tenant) { super(tenant); m_retry_wait_millis = getParamInt("retry_wait_millis", 5000); m_max_commit_attempts = getParamInt("max_commit_attempts", 10); m_max_read_attempts = getParamInt("max_read_attempts", 3); m_tenantPrefix = Utils.isEmpty(tenant.getNamespace()) ? "" : tenant.getNamespace() + "_"; m_ddbClient = new AmazonDynamoDBClient(getCredentials()); setRegionOrEndPoint();/* w w w . ja va 2 s .c o m*/ setDefaultCapacity(); // TODO: Do something to test connection? }
From source file:com.dell.doradus.db.s3.DynamoDBService2.java
License:Apache License
public DynamoDBService2(Tenant tenant) { super(tenant); String accessKey = getParamString("ddb-access-key"); String secretKey = getParamString("ddb-secret-key"); String endpoint = getParamString("ddb-endpoint"); m_readCapacityUnits = getParamInt("ddb-read-capacity-units", 1); m_writeCapacityUnits = getParamInt("ddb-write-capacity-units", 1); BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); m_client = new AmazonDynamoDBClient(awsCredentials); m_client.setEndpoint(endpoint);//w ww.j a v a 2 s. c om // try to connect to check the connection m_client.listTables(); m_logger.info("Started DynamoDB service. Endpoint: {}, read/write capacity units for new namespaces: {}/{}", new Object[] { endpoint, m_readCapacityUnits, m_writeCapacityUnits }); }
From source file:com.dynamo.DynamoData.java
License:Open Source License
public void init() throws Exception { AWSCredentials credentials = null;//from w w w . ja v a 2 s.c o m try { credentials = new BasicAWSCredentials("AKIAI6QKTRAQE7MXQOIQ", "wIG6u1yI5ZaseeJbvYSUmD98qelIJNSCVBzt5k2q"); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (C:\\Users\\bssan_000\\.aws\\credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usWest2 = Region.getRegion(Regions.US_WEST_2); dynamoDB.setRegion(usWest2); }