I am running a postgres db cluster on aws and I'd like to allow an ec2 instance to make programmatic changes to the database. When I try to run the program I get the following error:
"botocore.errorfactory.HttpEndpointNotEnabledException: An error occurred (HttpEndpointNotEnabledException) when calling the ExecuteStatement operation: HttpEndpoint is not enabled for resource arn:aws:rds:xxxx:xxxx:cluster:xxxx."
However, when I try to enable HttpEndpoint through the aws cli on the ec2 instance with the command:
aws rds modify-db-cluster --db-cluster-identifier db-xxxx --enable-http-endpoint
The flag is left unchanged. I also tried using the --apply-immediately flag, though the docs say this shouldn't matter. How do I enable an HttpEndpoint on a postgres 16.3 db cluster running on aws?
On an ec2 instance connected to the postgres cluster:
$ aws rds modify-db-cluster --db-cluster-identifier db-xxxx --enable-http-endpoint
and
$ aws rds modify-db-cluster --db-cluster-identifier db-xxxx --enable-http-endpoint --apply-immediately
both give the same response:
{
"DBCluster: {
"AllocatedStorage": xxxx,
"DBClusterIdentifier": "db-xxxxx",
...
"HttpEndpointEnabled: false,
...
}
I was expecting the response to have changed the HttpEndpointEnabled value to true:
{
"DBCluster: {
"AllocatedStorage": xxxx,
"DBClusterIdentifier": "db-xxxxx",
...
"HttpEndpointEnabled: true,
...
}
I also tried running:
aws rds enable-http-endpoint --resource-arn arn:aws:rds:us-east-2:xxxx:cluster:db-xxxx
On an Aurora PostgreSQL cluster, but ran into the following error:
An error occurred (InvalidParameterValue) when calling the EnableHttpEndpoint operation: Access Denied to API Version: APIDataApi
I tried opening up the Security Group to All Traffic, thinking that the command might be on some port other than 5432, but still the same error.
See comments for solution: Service not available in Ohio (us-east-2)
The modify-db-cluster
option only works with Aurora Serverless V1 according to the docs, so that likely won't help you. You write about a Postgres 16.3 DB Cluster, the latest supported version that I can see is 16.2 at the time of writing this, are you sure this is correct?
Aside from that, the first docs I linked mentioned that you're supposed to use the EnableHttpEndpoint
or the DisableHttpEndpoint
APIs for anything other that Aurora Serverless v1.
In your case the following command should enable the Endpoint:
$ aws rds enable-http-endpoint --resource-arn <cluster-arn>