Rule: Metadata: 'aws:copilot:description': "A CloudWatch event rule to trigger the job's state machine" Type: AWS::Events::Rule Properties: {{- if eq .ScheduleExpression "none"}} ScheduleExpression: "rate(5 minutes)" State: DISABLED {{- else }} ScheduleExpression: !Ref Schedule State: ENABLED {{- end }} Targets: - Arn: !Ref StateMachine Id: statemachine RoleArn: !GetAtt RuleRole.Arn RuleRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: events.amazonaws.com Action: sts:AssumeRole {{- if .PermissionsBoundary}} PermissionsBoundary: !Sub 'arn:${AWS::Partition}:iam::${AWS::AccountId}:policy/{{.PermissionsBoundary}}' {{- end}} Policies: - PolicyName: EventRulePolicy PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: states:StartExecution Resource: !Ref StateMachine