Api server in EC2 not able to connect to RDS - amazon-web-services

I am new to aws as well as server and it's configurations.
I have an app server which basically is an API server.
When I test running with my localhost I am able to access it.
curl --location --request GET 'http://localhost:5000/api/Supplier'
But not with my machine public or private or elastic IPs.
curl --location --request GET 'http://xxx-xx-xx-xx:5000/api/Supplier'
i get the following error
(7) Failed to connect to xxx-xx-xx-xx port 5000: Connection refused
Are there any additional things that are needed here?

Related

how to connect elasticsear API through Cassandra

when i connect elastic search using curl -XGET "http://localhost:9200/" Command through elassandra .show connection refused error
from bin i am running Cassandra -e. here is no error in logs but still not able to access ES on localhost:9200
how to connect elastisearch api through elassandra

Can't access Amazon Neptune via SSH tunnel Sigv4

I'm trying to access Neptune cluster status endpoint from an SSH tunnel. I can hit it without issue on my bastion host, but when doing via ssh tunnel, I get:
https://localhost:8182/status
{"detailedMessage":"Bad request.","requestId":"random-request-id-appears-here","code":"BadRequestException"}
How can I do this? It seems like I need something with sigv4. I was hoping to see the response work after hitting this in my browser.
I've also tried awscurl after setting my env variables, I get:
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /status (Caused by SSLError(SSLCertVerificationError("hostname 'localhost' doesn't match either of '*.id.us-east-2.neptune.amazonaws.com', '*.id.us-east-2.neptune.amazonaws.com', '*.cluster-custom-id.us-east-2.neptune.amazonaws.com', '*.cluster-ro-id.us-east-2.neptune.amazonaws.com'")))
When using SSH tunnel for accessing Neptune using localhost, one need to explicitly pass Neptune endpoint as host header for signing the request. Consider below example for awscurl:
awscurl -k --service neptune-db --access_key $ACCESS_KEY --secret_key $SECRET_KEY --region <neptune_instance_region> --session_token $SESSION_TOKEN --header 'host: <neptune-cluster-endpoint-withouthttp-withoutport>' https://localhost:8182/status
Without the explicit host header, request would be signed using "localhost" with an invalid signature.

Google Cloud SQL pPostgreSQL psql client connection

Followed instructions to created Google Cloud SQL instance with PostgreSQL db. I can examine it from glcoud command line with the instance name:
gcloud sql instances describe my-fancy-instance-name
I get back oodles of details!
When I created the SSL certs, it gave me the psql command to connect, which matches the instructions from the instructions given by Google documentation on how to connect via public IP (I left that enabled for now).
Now, with the discovered IP and port, which was also verified by the gcloud command, I try to call psql to connect:
psql "sslmode=verify-ca sslrootcert=server-ca.pem \
sslcert=client-cert.pem sslkey=client-key.pem \
hostaddr=my_INSTANCE_IP \
user=my_USER_NAME dbname=my_DB_NAME"
It takes a bit but it comes back and reports:
psql: could not connect to server: Operation timed out
Is the server running on host “nnn.ooo.ppp.qqq" and accepting
TCP/IP connections on port xxxxx?
and I verified the ip, but the port was NOT returned by the gcloud command...
Now, I have my SSL (.pem) files in ~/.postgress folder and added that path in my command as well, but no joy.
Any ideas why the psql can't connect (connection times out)? Especially since the gcloud command works?
The error message suggests that the CloudSQL instance is not exposed to the local host IP. As in the documentation step 7, you need to add your local psql client IP to the Authorized network. Can you confirm if you did that? If your local host IP is dynamic, then you have to regularly re-add the IP to Authorized network once your local IP changed.
Following the Google documentation you provided, I successfully connected to my Cloud Postgresql database from my local psql client.

How can I access application deployed on localhost of AWS remote server?

I have developed a set of apis on my AWS server.
When I do npm start , application is started on a particular port of aws localhost.
I am able to hit the apis using curl command from my terminal window.
eg:
curl -s -X GET \
"http://localhost:6001/getAssetDetails?assetId=1"\
-H "content-type: application/json"
How to access the apis from my host system using postman installed on my host machine?
How to access localhost applications of AWS server from web browser of windows host? What URL should I hit from my host machine?
You have to add Inbound rules in Access control list (ACL) of your EC2 instance. Ports are blocked by default in aws server. This might help aws-doc

AWS EC2 curl request giving host not found

I have a curl command which works fine on my local system,
however the same command when run from an EC2 instance gives the error
curl: (6) Could not resolve host: qasu-cmx1.uto-netcom.org
Ive kept HTTP and HTTPS open to the world in the security group of the EC2 instance.
Any thoughts on what could be the possible reason?