Ions Tutorial: Comments

Edit 1: I’ve deleted my initial post since the problem had to do with the fact that my aws profile had been somehow messed up. I’m now able to follow the ions tutorial just fine. Sorry about my premature post.

Edit 2: I’ve just completed the tutorial and am quite impressed with the power of ions. I knew in theory what it does, but this exercise made me understand how easy it is now to deploy clojure code. I highly recommend everyone to just try the tutorial.

There was one gotcha in the tutorial. When I tried to access API gateway by calling

curl https://$(obfuscated-name) -d :hat

as the tutorial suggests, the response was

{"message":"Missing Authentication Token"}.

After a bit of research on Google, I found that I can call the API on any path but the root path, so calling

curl https://$(obfuscated-name) -d :hat

gave me a successful response. I figured this out after reading the following paragraph found on this aws document.

The Invoke URL link points to the root resource of the API in its beta stage. Navigating to the URL by choosing the link calls the beta stage GET method on the root resource. If methods are defined on child resources and not on the root resource itself, choosing the Invoke URL link will return a {"message":"Missing Authentication Token"} error response. In this case, you must append the name of a specific child resource to the Invoke URL link.

Aside from this gotcha, the tutorial was easy to follow. One thing I find missing in the tutorial is how to clean up the resources created during this tutorial without impairing the main functionality of Datomic Cloud.

If I understand it correctly, the following resources were created during the tutorial.

  • the S3 bucket that starts with “datomic-code”
  • the CodeDeploy application with the system name
  • 2 web service ions in AWS Lambda (namely ${GROUP)-items-by-type-web and ${GROUP)-get-tutorial-schema)
  • 8 lambda functions in AWS Lambda that start with the system name
  • the API gateway

Since I did the first upgrade just before the tutorial, I’m not so sure if the CodeDeploy application was created during the tutorial or as a result of the upgrade. Also, I believe all the lambda functions were created during the tutorial, but I’m not entirely sure about this, because I had never opened the AWS Lambda console before.

So it’s impossible to host a web app that serves HTML with ions?

I don’t know why you wouldn’t be able to serve HTML from an ion. Though I would recommend serving any static assets (CSS, JS, images) from somewhere else.

Most of the resources you mentioned are created as part of the Datomic system itself (not the ion tutorial specifically).
You can find information on deleting a Datomic system here:

In the tutorial, you created the API gateway manually, so that would not be removed by deleting the system. The lambda functions, s3 buckets, etc. are all managed by the Datomic system and you shouldn’t remove or alter them manually (see Deleting a System)