Connecting to an Instance over HTTPS
This section describes how to connect to a GeminiDB DynamoDB-Compatible instance over HTTPS.
Prerequisites:
- The instance and ECS must be in the same VPC and subnet.
- The instance security group must allow access from the ECS. For details, see Setting Security Group Rules for a GeminiDB DynamoDB-Compatible Instance.
- Enable SSL for the GeminiDB instance by following Enabling SSL for a GeminiDB DynamoDB-Compatible Instance and download a certificate by following Downloading an SSL Certificate. Take a Java application as an example. The command for importing the certificate is as follows:
keytool -importcert -alias hw -file ca.cert -keystore truststore.jks -storepass password

1. For compatibility purposes, you can still use HTTP after SSL is enabled. To meet high security requirements, you can modify a parameter to disable HTTP. For details, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
2. Currently, an EIP cannot be used over HTTPS.
Procedure:
- Add Maven dependencies. Add dependencies related to AWS SDK for Java 2.x to the pom.xml file.
<dependencies> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>dynamodb</artifactId> <version>2.x.x</version> </dependency> </dependencies>
- Connect to the GeminiDB DynamoDB-Compatible instance using DynamoDBClient over HTTPS.
Java code example:
import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.model.*; public class SourceDemo { public static AWSCredentialsProvider myCredentials = new AWSStaticCredentialsProvider( new BasicAWSCredentials("your_ak", "your_sk")); public static void main(String[] args) { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("https://127.0.0.1", "region_a")) .withCredentials(myCredentials) .build(); System.out.println(client.listTables()); CreateTableRequest request = new CreateTableRequest() .withTableName("test_001") .withProvisionedThroughput(new ProvisionedThroughput(1000L, 1000L)) .withKeySchema( new KeySchemaElement("id", KeyType.HASH) ) .withAttributeDefinitions( new AttributeDefinition("id", ScalarAttributeType.N) ); System.out.println(client.createTable(request)); } }
GeminiDB DynamoDB-Compatible API is completely compatible with DynamoDB. For details about common operations, see official DynamoDB documentation.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot