【问题标题】:Can Azure Container Instances be invoked using triggers?可以使用触发器调用 Azure 容器实例吗?
【发布时间】:2018-05-24 18:59:21
【问题描述】:

我想使用 Azure 容器实例,使用旧版应用运行长时间(10 分钟)的分析测试。当 CosmosDB 中出现项目时,我想触发新容器实例的启动。

容器将有一个轻量级代理,该代理将从 CosmosDB 中提取数据,将其写入容器文件系统,运行旧版应用程序,获取输出并将其推送回 CosmosDB。

Cosmos 只是一个例子。可以是 blob,也可以是任何其他可以存储几 Mb 数据的东西。

是否可以通过这种方式触发新容器的创建?任何参考/示例代码?

【问题讨论】:

    标签: triggers azure-functions azure-container-instances


    【解决方案1】:

    您可以触发容器从逻辑应用或 Azure 函数运行。两种情况都有样本:

    事件驱动使用函数:https://github.com/Azure-Samples/aci-event-driven-worker-queue

    使用逻辑应用触发:https://github.com/Azure-Samples/aci-logicapps-integration

    【讨论】:

      【解决方案2】:

      我发现的另一种方法:

      使用事件网格订阅触发 Azure 自动化 Runbook(通过在该 Runbook 上创建的 Webhook)。在我的例子中,事件网格对 storage account event 做出反应,即 blob 创建。 Runbook 依次通过如下所示的 Powershell 脚本启动容器组:

      Select-AzureRmSubscription -SubscriptionName "yourSubscription"
      
      Invoke-AzureRmResourceAction -ResourceGroupName yourResourceGroup -ResourceName yourContainerGroupName -Action Start -ResourceType Microsoft.ContainerInstance/containerGroups -Force
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-22
        • 1970-01-01
        • 2023-04-05
        • 1970-01-01
        • 2022-11-06
        • 2020-05-25
        相关资源
        最近更新 更多