简体   繁体   中英

create SSM document with boto3 that shuts down microservices and their associated EC2 instances

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM