I'm currently evaluating Datomic and I've deployed a production topology using a split stack. DatomicCloudVersion is 9095 and DatomicCFTVersion is 884. The CloudFormation stack created two API Gateway endpoints: datomic-[system]-client-api
and datomic-[system]-ions
.
From my local computer I can get a client by using datomic-[system]-client-api
endpoint:
(d/client {:system "my-system"
:server-type :ion
:region "us-east-1"
:endpoint "https://[endpoint-id].execute-api.us-east-1.amazonaws.com/"})
Above, https://[endpoint-id].execute-api.us-east-1.amazonaws.com/
is the client-api API Gateway endpoint. It works, but the endpoint is open to the world. I then added an IAM authorizer to datomic-[system]-client-api
and used an authorized IAM user to make a request to the now authenticated endpoint:
awscurl --service execute-api -X GET https://[endpoint-id].execute-api.us-east-1.amazonaws.com --profile datomic
{:s3-auth-path "long s3 path"}
awscurl
is just a tool to make authenticated calls to AWS services. As you can see, I can get a response from the endpoint by using my local profile named "datomic". If I try using regular curl without the v4 AWS signature it fails:
curl -X GET https://[endpoint-id].execute-api.us-east-1.amazonaws.com
{"message":"Forbidden"}
Works as expected. The problem is now I can't get a client using:
(d/client {:system "my-system"
:server-type :ion
:region "us-east-1"
:creds-profile "datomic"
:endpoint "https://[endpoint-id].execute-api.us-east-1.amazonaws.com/"})
The response I get is:
{:status 403,
:headers
{"apigw-requestid" "EUsyNi9aIAMEPlg=",
"connection" "keep-alive",
"content-length" "23",
"date" "Thu, 19 Aug 2021 17:01:40 GMT",
"content-type" "application/json"},
:body "{\"message\":\"Forbidden\"}"}
It is as if the d/client
call is ignoring the profile or not generating the proper signature. I tried setting the AWS_PROFILE
environment variable as well, to no avail.
Is using an IAM Authorizer not the proper way to go? How can I protect both the client-api and ions endpoints? Finally, what's the difference between the client-api and ions endpoints?