Created
February 25, 2022 13:18
-
-
Save mnanchev/6258825665da23e4e9ad7fe51c11d9c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Comment": "A description of my state machine", | |
"StartAt": "RaiseJiraTicket", | |
"States": { | |
"RaiseJiraTicket": { | |
"Type": "Task", | |
"Parameters": { | |
"DocumentName": "AWS-CreateJiraIssue", | |
"Parameters": { | |
"IssueSummary": [ | |
"Security alert: nuclear launch detected" | |
], | |
"JiraURL": [ | |
"https://helecloud.atlassian.net" | |
], | |
"ProjectKey": [ | |
"HCSD" | |
], | |
"IssueDescription.$": "States.Array(States.Format('Description: {}\\\\nAccount:{}\\\\nTime:{}\\\\nRegion:{}\\\\nRemediation:{}\\\\nAffected Resources: {}\\\\n', $.detail.findings[0].Description, $.detail.findings[0].AwsAccountId, $.time, $.detail.findings[0].Resources[0].Region,$.detail.findings[0].Remediation.Recommendation.Url, $.detail.findings[0].Resources[0].Id))", | |
"IssueTypeName": [ | |
"Incident" | |
], | |
"JiraUsername": [ | |
"[email protected]" | |
], | |
"PriorityName": [ | |
"Medium priority" | |
], | |
"SSMParameterName": [ | |
"/jira/token" | |
] | |
} | |
}, | |
"Resource": "arn:aws:states:::aws-sdk:ssm:startAutomationExecution", | |
"Next": "WaitAutomationExecution" | |
}, | |
"WaitAutomationExecution": { | |
"Type": "Wait", | |
"Seconds": 360, | |
"Next": "GetAutomationExecutionStatus" | |
}, | |
"GetAutomationExecutionStatus": { | |
"Type": "Task", | |
"Parameters": { | |
"AutomationExecutionId.$": "$.AutomationExecutionId" | |
}, | |
"Resource": "arn:aws:states:::aws-sdk:ssm:getAutomationExecution", | |
"Next": "CheckIfSuccessful" | |
}, | |
"CheckIfSuccessful": { | |
"Type": "Choice", | |
"Choices": [ | |
{ | |
"Variable": "$.AutomationExecution.AutomationExecutionStatus", | |
"StringEquals": "Failed", | |
"Next": "NotifyOnFailure" | |
} | |
], | |
"Default": "PassOnSuccess" | |
}, | |
"NotifyOnFailure": { | |
"Type": "Task", | |
"Resource": "arn:aws:states:::sns:publish", | |
"Parameters": { | |
"Message.$": "$", | |
"TopicArn": "arn:aws:sns:eu-west-2:690543140147:failedAlarms" | |
}, | |
"End": true | |
}, | |
"PassOnSuccess": { | |
"Type": "Pass", | |
"End": true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment