workshops/ec2-auto-scaling-with-multiple-instance-types-and-purchase-options/spot-interruption-handler.yaml [91:123]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - Effect: Allow
            Action:
            - logs:CreateLogGroup
            Resource: '*'
      - PolicyName: lambda-SpotInterruptHandlerPolicy
        PolicyDocument:
          Version: '2012-10-17'
          Statement:
          - Effect: Allow
            Action:
            - autoscaling:DetachInstances
            - ec2:DescribeInstances
            Resource: '*'
  
  CloudWatchEventRule:
    DependsOn:
    - SpotInterruptionHandlerFunction
    Properties:
      Description: Events rule for EC2 Spot Instance Interruption Notices
      EventPattern:
        detail-type:
        - EC2 Spot Instance Interruption Warning
        source:
        - aws.ec2
      State: ENABLED
      Targets:
      - Arn:
          Fn::GetAtt:
          - SpotInterruptionHandlerFunction
          - Arn
        Id:
          Ref: SpotInterruptionHandlerFunction
    Type: AWS::Events::Rule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



workshops/running-amazon-ec2-workloads-at-scale/spot-interruption-handler.yaml [79:111]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - Effect: Allow
            Action:
            - logs:CreateLogGroup
            Resource: '*'
      - PolicyName: lambda-SpotInterruptHandlerPolicy
        PolicyDocument:
          Version: '2012-10-17'
          Statement:
          - Effect: Allow
            Action:
            - autoscaling:DetachInstances
            - ec2:DescribeInstances
            Resource: '*'
  
  CloudWatchEventRule:
    DependsOn:
    - SpotInterruptionHandlerFunction
    Properties:
      Description: Events rule for EC2 Spot Instance Interruption Notices
      EventPattern:
        detail-type:
        - EC2 Spot Instance Interruption Warning
        source:
        - aws.ec2
      State: ENABLED
      Targets:
      - Arn:
          Fn::GetAtt:
          - SpotInterruptionHandlerFunction
          - Arn
        Id:
          Ref: SpotInterruptionHandlerFunction
    Type: AWS::Events::Rule
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



