Working with cloud is rather like waiting for expected features than waiting for breakthroughs. Few times a year we have a major announcements about new, but expected features in Azure - and I don't know how it is about you, but I am, in most cases, really greatful for all the engineers working on making our lives harder easier.
But sometimes there is a chance to "catch" something BIG. A breakthrough. And now I can show you something like this. Not because of new, spectacular tech, like quantum computing, but because of making our lives really easier and more server...less.
Around a week ago, a new functionality was added to Azure Logic Apps. Azure Container Instances connector. With this connector, we are able to perform actions on ACI.
At this point we have 6 actions on the list:
- Create container group
- Delete container group
- Get a list of container groups in resource group
- Get a list of container groups in subscription
- Get logs of a container
- get properties of a container group
Assuming that you have a function (algorithm) written in any language you want (supported by Linux or Windows), running on container, you can run it without maintaining a server, on Azure. And you will pay only for RAM and CPU used by container and Logic Apps actions and triggers.
Everything you need is to point the Docker image you want to use for deployment, a container group to deploy to and few configuration parameters.
Working with ACI (Azure Container Instances), we are creating so-called Container Group, not just deploying single container. It means, that you can deploy more than one container at once - you just need to define the whole group. A group definition is just a simple JSON.
Another action possible with ACI connector for Azure Logic Apps is a container group deletion action. In ACI (at this point in time), we have no "shut down the container" option nor CI/CD pipeline. It means, that we need to delete a container group, if we want to stop it or redeploy new version. It is much simpler in configuration than creation action.
For complete runtime - where container group is making some task at a specified time and then containers are ending their life - we need an Azure Logic Apps action checking group's state. When a container group will succeed with the task (and all the containers will be terminated), our logic should catch this state and delete the group.
Of course the trigger depends on your needs. The "Until" loop can contain an action, which is checking the group's state in time and if the state is equal to "Succeeded", then "Delete container group" action is performed. To do that, we need to use "Get properties of a container group" action. The loop is constantly checking a state of the group (with 1h timeout defined).
After triggering the flow, we can monitor it (even live). Of course the completion time (time to "Succeed" state) depends on what your containers are doing.
Azure Container Instances pricing: Link
Azure Logic Apps pricing: Link