In this procedure, you create the database link at BigAnimal to AWS RDS Oracle DB instance with private access.
1. Create the target group targeted with AWS RDS Oracle DB instance.
- The target group requires Oracle server IP and port. To get the IP address:
dig +short $RDS_Oracle_Endpoint
- Select VPC of Oracle DB instance
2. Create the Network Load Balancer with the target group created at the above step.
Enable cross-zone attribute of the load balancer.
3. Create VPC endpoint service based on the load balancer created at the above step.
Save the endpoint service name, we need to use it later. For example:
com.amazonaws.vpce.us-east-1.vpce-svc-0a366e7796f8e0f62
4. Create the endpoint at BigAnimal VPC to connect with the endpoint service created at the above step.
Set the security group with inbound rule to allow BigAnimal VPC access Oracle port 1521.
Similarly, set the security group with outbound rule to allow BigAnimal VPC to access Oracle port.
5. Accept the endpoint connection at endpoint service created.
6. Create database link at BigAnimal.
Get the DNS name of the endpoint. For example:
vpce-05cd2db1457d0acad-i81rdqtv.vpce-svc-0a366e7796f8e0f62.us-east-1.vpce.amazonaws.com
Run the sql to create the database link and test the connection:
CREATE PUBLIC DATABASE LINK mydblink CONNECT TO $ORAUSERNAME IDENTIFIED BY '$ORAPWD' USING '//vpce-05cd2db1457d0acad-i81rdqtv.vpce-svc-0a366e7796f8e0f62.us-east-1.vpce.amazonaws.com:1521/ORCL';
select * from dual@mydblink;
The sample output: