-
Notifications
You must be signed in to change notification settings - Fork 485
Dynamo DB
gorzell edited this page Feb 20, 2013
·
6 revisions
Archaius currently supports two different configurations for using Dynamo DB as a configuration source. One is a simple key value pair, in which you cannot have duplicate keys. The other makes use of deployment context so that you can specify overrides in what is currently a fairly limited way. The details of each are below:
In what probably amounts to overkill, these properties are themselves dynamic so you could change tables, etc on the fly if you wanted to.
Property | Description | Default Value |
---|---|---|
com.netflix.config.dynamo.tableName | Name of the dyanmo table with your properties | archaiusProperties |
com.netflix.config.dynamo.keyAttributeName | Name of the attribute that contains the property Key | key |
com.netflix.config.dynamo.valueAttributeName | Name of the attribute that contains the property Value | value |
KeySchemaElement key = new KeySchemaElement().withAttributeName("key").withAttributeType("S");
KeySchema ks = new KeySchema().withHashKeyElement(key);
// Provide the initial provisioned throughput values as Java long data types
ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput()
.withReadCapacityUnits(1L)
.withWriteCapacityUnits(1L);
CreateTableRequest request = new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(ks)
.withProvisionedThroughput(provisionedThroughput);
CreateTableResult result = client.createTable(request);
h2. Creating a Configuration Source
In what probably amounts to overkill, these properties are themselves dynamic so you could change tables, etc on the fly if you wanted to.
Property | Description | Default Value |
---|---|---|
com.netflix.config.dynamo.tableName | Name of the dyanmo table with your properties | archaiusProperties |
com.netflix.config.dynamo.keyAttributeName | Name of the attribute that contains the property Key | key |
com.netflix.config.dynamo.valueAttributeName | Name of the attribute that contains the property Value | value |
com.netflix.config.dynamo.contextKeyAttributeName | Name of the attribute that contains the contextKey | contextKey |
com.netflix.config.dynamo.contextValueAttributeName | Name of the attribut that contains the contextValue | contextValue |
KeySchemaElement key = new KeySchemaElement().withAttributeName("key").withAttributeType("S");
KeySchemaElement range = new KeySchemaElement().withAttributeName("contextKey").withAttributeType("S");
KeySchema ks = new KeySchema().withHashKeyElement(hashKey).withRangeKeyElement(range);
// Provide the initial provisioned throughput values as Java long data types
ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput()
.withReadCapacityUnits(1L)
.withWriteCapacityUnits(1L);
CreateTableRequest request = new CreateTableRequest()
.withTableName(tableName)
.withKeySchema(ks)
.withProvisionedThroughput(provisionedThroughput);
CreateTableResult result = client.createTable(request);