4. Create the SSM Document

In this step, we will create a SSM document that on execution will introduce a spike in latency metric which eventually leads to execution of cross-region failover via the Lambda Code updated in the previous step

  1. Select the Services dropdown at the very top of the AWS management console, and type Systems Manager. Select Systems Manager from the filtered results to navigate to the Systems Manager service console
  2. Select Documents on left panel of the console
  3. Select Create command or session
    • Enter SSMLatencyDocument-Reinvent for Name
    • Scroll down to the Content section
    • Select YAML
    • Replace the contents currently in the YAML field with the following:
      schemaVersion: "2.2"
      description: "SSM RunCommand document for re:Invent ENT305 Workshop"
      parameters: 
        jitter: 
          default: "5"
          description: "Jitter added to base latency"
          type: String
        latency: 
          default: "20"
          description: "Base latency in milliseconds"
          type: String
        probability: 
          default: "25"
          description: "Probability of event happening"
          type: String
      mainSteps: 
        -     
          name: CreateLatency
          action: "aws:runShellScript"
          inputs: 
            runCommand: 
              - "sudo yum install iproute-tc -y"
              - "sudo tc qdisc add dev eth0 root netem delay {{latency}}ms {{jitter}}ms {{probability}}%"
  • Click Create document