使用BOTO3创建SSM文档,该文档关闭微服务及其相关的EC2实例

发布于 2025-02-04 12:27:15 字数 1111 浏览 4 评论 0原文

我被分配了一个任务来开发一个解决方案,该解决方案可以并行关闭在给定的EC2实例上运行的所有微服务过程,然后关闭EC2实例本身,并在同一组EC2实例上并行执行此操作。这应该从yaml配置文件(让我们称为父)中获取类似于以下标识的Micro Services安装点的输入:

fabric: usprod1
sequence:
  stateless:
    - admin-portal
    - dashboard
    - haraka
    - vm-prometheus
    - watchtower-server
    - web-analytics-service
  dbclusters:
    - kafka
    - druid
    - rabbitmq
  zkclusters:
    - zookeeper
  shared:
    - eureka
  bootstrap:
    - consul
    - census

我的解决方案应该创建与与每个安装点相对应的“儿童” SSM文档一个服务组,其中可能存在与每个安装点相关的多个EC2实例。我已经查看了以下网页,但是他们对我应该如何使用父母文件生成孩子的方式没有任何见解:

我如何将多个参数传递给aws ssm send_command with boto3 https://docs.aws。 Amazon.com/systems-manager/latest/userguide/create-ssm-document-api.html

I have been assigned a task to develop a solution that shut down all microservice processes running on a given EC2 instance in parallel and then shut down the EC2 instance itself and do this on a set of EC2 instances in parallel. This is supposed to take input from a YAML configuration file (let's call it the parent) similar to the following that identifies the mount point of the micro services:

fabric: usprod1
sequence:
  stateless:
    - admin-portal
    - dashboard
    - haraka
    - vm-prometheus
    - watchtower-server
    - web-analytics-service
  dbclusters:
    - kafka
    - druid
    - rabbitmq
  zkclusters:
    - zookeeper
  shared:
    - eureka
  bootstrap:
    - consul
    - census

My solution is supposed to create "child" SSM documents that correspond to each mount point within a service group where there might be multiple EC2 instances associated with each mount point. I've reviewed the following web pages, but they don't give me any insight as to how I'm supposed to use the parent YAML file to generate the children:

How do I pass multiple parameters to AWS SSM send_command with Boto3
https://docs.aws.amazon.com/systems-manager/latest/userguide/create-ssm-document-api.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

执手闯天涯 2025-02-11 12:27:15

可以使用几种方法来解决此情况,但我建议您在lambda或步骤函数首先,然后您应该很好。

This case can be tackled using few approaches but I would suggest do some reading on Lambda or Step Functions first and then you should be good to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文