Connecting to a GeminiDB DynamoDB-Compatible Instance Using Python
This section describes how to connect to a GeminiDB DynamoDB-Compatible instance using Python.
Usage Notes
- The target instance and ECS must be in the same VPC and subnet.
- The instance security group must allow access from the ECS.
Scenario 1: If the instance is associated with the default security group, you do not need to set security group rules.
Scenario 2: If the instance is not associated with the default security group, check whether the security group rules allow access from the ECS.
- If yes, the ECS can connect to the instance.
- If no, add an inbound rule to the security group.
For details, see Setting Security Group Rules for a GeminiDB DynamoDB-Compatible Instance.
Prerequisites
- A GeminiDB DynamoDB-Compatible instance has been created.
- For details about how to create an ECS, see Purchasing an ECS in Getting Started with Elastic Cloud Server.
- JDK has been installed on the ECS.
Obtaining the IP Address of a GeminiDB DynamoDB-Compatible Instance
- Log in to the Huawei Cloud console.
- In the service list, choose Databases > GeminiDB.
- On the Instances page, click the instance name. On the displayed Basic Information page, view IP addresses of the load balancer and each node.
If no load balancer address is available, choose Service Tickets > Create Service Ticket in the upper right corner of the console and contact the customer service.
Figure 1 Viewing the IP address
Replace the IP address in the following code example with the IP address queried in 3.
Python code example:
#!/usr/bin/python import boto3 url = 'http://***.***.***.***' dynamodb = boto3.resource('dynamodb', endpoint_url=url, aws_access_key_id='ak', aws_secret_access_key='sk', region_name="region-a")
GeminiDB DynamoDB-Compatible API is completely compatible with DynamoDB. For details about common operations, see official DynamoDB documents.
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