Sunday, 11 March 2018

AWS OpsWorks Stacks (Lifecycle Event)


Overview
  • allow to build very fined-grained script to respond to these events
  • event comes with stack state JSON (state of the know world: elbs, other instances, rds, etc.)
    • figure out how should my service be configured
    • if instance generates attribute on the fly it is NOT part of stack state

Event Type


  • setup
    • trigger
      • instance booted first time, initialization ("user-data on steroids")
      • compare "cloud-init" on normal EC2 instance
    • use cases
      • install necessary packages, applications (e.g. Apache, Tomcat)
    • Includes "configure" and "deploy" events
  • configure 
    • trigger
      • any instance enters or leaves online state
        • includes newly booted instance
          • e.g. after auto-healing
        • EIP associated/disassociated
        • ELB attached/detached from a layer   
    • use cases
      • ELB setup, replication etc.
      • Database adds ACL entry that allows instance to connect to it
      • MongoDB, Cassandra, Kafka - setup replication    
    • There is a new node in the system - "do I need to reconfigure myself?"|
    • Database is gone - "what do I do?"
  • deploy
    • trigger
      • explicitly triggering deployment (via UI/API)
    • use cases
      • new version of Java application
        • application server downloads the code
        • restart server
      • generic hook (ssh, rsync)
  • undeploy 
    • use cases     
      • large number of PHP "virtual hosts"     
        •  you remove tenant and get rid of his "virtual host"
  • shutdown
    • trigger
      • instance is about to be terminated
    • use cases
      • gracefully stop application
      • upload logs
    • configurable timeout

No comments:

Post a Comment