Can Azure Container Instances be invoked using triggers?
Asked Answered
B

2

9

I'd like to use Azure Container instances to run a long (10 mins) analysis test using a legacy app. When an item appears in CosmosDB, I want to trigger the launch of a new container instance.

The container will have a lightweight proxy that will pull the data from CosmosDB, write it to container file system, run the legacy app, get the output and push it back to CosmosDB.

Cosmos is just an example. Could be blob, or anything else that can store a few Mbs of data.

Is it possible to trigger the creation of new containers in this way? Any references/sample code?

Beers answered 24/5, 2018 at 18:59 Comment(0)
L
11

You can trigger the container to run either from Logic Apps, or Azure Function. There are samples for both cases:

Event driven using function: https://github.com/Azure-Samples/aci-event-driven-worker-queue

Trigger using Logic Apps: https://github.com/Azure-Samples/aci-logicapps-integration

Library answered 19/6, 2018 at 23:28 Comment(0)
A
3

Another way I've found to do this:

Use an Event Grid subscription to trigger an Azure Automation runbook (by means of a webhook created on that runbook). In my case, the Event Grid reacts to a storage account event, namely blob creation. The runbook in turn starts the container group by means of a Powershell script like the following:

Select-AzureRmSubscription -SubscriptionName "yourSubscription"

Invoke-AzureRmResourceAction -ResourceGroupName yourResourceGroup -ResourceName yourContainerGroupName -Action Start -ResourceType Microsoft.ContainerInstance/containerGroups -Force
Apotheosis answered 23/7, 2019 at 20:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.