It should possible to hook into deployment events in Datomic Ions. You can create an EventBridge event for each step in the CodeDeploy deployment and trigger a Lambda function. I’ve done that before without an issue.
However, if you just want to execute a function to create connections, you can just place that function in one of the namespaces that gets loaded into your Ions application. As soon as Datomic loads your namespace, the function will be executed. Here you can see my answer about starting a background thread to poll from a queue when the Datomic application is started. It could give an idea about how to implement in your case.
@furkan3ayraktar thanks for the response. The issue with using a Lambda for lifecycle is that it only triggers an ion on one instance, which obviously doesn’t work in a prod topology.
When add new instances to the ASG, I’d like to initiate and verify 3rd party connections (e.g. db / pubsub) before accepting requests
I’d like to perform additional checks (e.g. verify 3rd party connections) within ALB / ELB health checks so that unhealthy instances are removed from the target group
I’d like to gracefully shutdown 3rd party connections before EC2 instance shutdown