forked from airbnb/ottr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute.py
executable file
·41 lines (36 loc) · 1.08 KB
/
execute.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import time
import json
import boto3
REGION = ''
AWS_ACCOUNT = ''
DYNAMODB_TABLE = ''
STEP_FUNCTION_ARN = f'arn:aws:states:{REGION}:{AWS_ACCOUNT}:stateMachine:otter-state'
# Example Payload
payload = {
"assets": [
{
"hostname": "panos01.example.com",
"common_name": "panos01.example.com",
"certificate_validation": "True",
"task_definition": "otter-panos-9x-lets-encrypt",
"dns": "xxx (Route53 Hosted Zone ID)"
},
{
"hostname": "f501.example.com",
"common_name": "f501.example.com",
"certificate_validation": "False",
"task_definition": "otter-f5-14x-lets-encrypt",
"dns": "xxx (Route53 Hosted Zone ID)"
}
],
"region": REGION,
"table": DYNAMODB_TABLE
}
string_payload = json.dumps(payload)
if __name__ == "__main__":
sfn_client = boto3.client('stepfunctions')
output = sfn_client.start_execution(
stateMachineArn=STEP_FUNCTION_ARN,
name='otter_{0}'.format(time.time()),
input=string_payload
)