Skip to content

Query RDS Endpoint

0

Is there a way to query some dynamic views or other tables in RDS Oracle for the instance endpoint used to connect to instance? We have some scripts that need that and we cant use the AWS console for that query.

I assume that the ENDPOINT will stay the same mostly unless there was a snapshot RESTORE in which case a new RDS is created.

2 Answers
0

Yes, you can query the endpoint of your RDS Oracle instance programmatically without using the AWS console. The recommended approach is to use the AWS CLI or the Amazon RDS API.

Using the AWS CLI, you can call the describe-db-instances command to retrieve the endpoint information:

aws rds describe-db-instances --filters "Name=engine,Values=oracle"

You can then search for "Endpoint" in the output to find the DNS name and port number for your Oracle DB instance.

Alternatively, you can use the Amazon RDS API by calling the DescribeDBInstances operation. In the output, you'll find the values for the endpoint address, endpoint port, and master user name.

Regarding your assumption about endpoints: You're correct that an RDS endpoint is a unique network address assigned to each database instance within RDS. The endpoint will remain the same for the lifetime of the DB instance. However, when you restore from a snapshot, Amazon RDS creates a new database instance with a new endpoint. In such cases, you would need to update your application configuration to point to the new RDS database endpoint.
Sources
Finding the connection information for an Amazon RDS DB instance - Amazon Relational Database Service
Finding the endpoint of your RDS for Oracle DB instance - Amazon Relational Database Service
How to rename and retain the endpoint name for Amazon RDS | AWS Database Blog

answered 8 months ago
  • I dont think you can use AWS CLI within an oracle SQL script though. Can this query be using a metdata VIEW and SQL or not? I believe AWS CLI commands are scripted using python programming language.

  • I assume you use RDS API in PL/SQL or SQL for querying the end point?

0

There’s no guaranteed way to map an IP like 18.220.67.161 to a specific hosted domain unless: The server replies with a ServerName or SSL cert (via HTTPS inspection), Or reverse DNS (PTR) is configured, which in this case, it is not.

Breakdown of What You Can Try

  1. Reverse DNS Lookup nslookup 18.220.67.161 Returns: ** server can't find 161.67.220.18.in-addr.arpa: NXDOMAIN Meaning: No reverse DNS (PTR record) is set, so no domain tied directly.

  2. Check What’s Hosted (HTTP/S) curl -I http://18.220.67.161 or openssl s_client -connect 18.220.67.161:443

This might show: A Server header A redirect with a domain name SSL certificate Common Name (CN) / Subject Alt Names (SAN) You might get lucky if the service doesn’t require a proper Host header.

  1. Shodan or Censys.io Search the IP in: https://www.shodan.io/host/18.220.67.161 https://search.censys.io/ They often track TLS certificates, banners, or services running on the IP, sometimes exposing hosted domains.

  2. Check for Hosting Context This IP belongs to Amazon EC2 (AWS), and based on whois, it's within: Amazon Technologies Inc. (AT-88-Z) NetRange: 18.32.0.0 - 18.255.255.255 It could be: A public EC2 instance (Elastic IP) A service behind ALB/NLB A temporary resource used for outbound NAT

There’s no direct public mapping of IP → hosted domain in AWS unless the owner publishes it.

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.