Execute a State Machine on AWS

Step-by-Step Guide

  • Create Functions
  • Create State Machine
  • Add S3 Buckets for Event to occur
  • Add S3 bucket for State Machine Logging Storage
  • Add a Cloud Trail
  • Add a Cloud Watch Event

Printing Event when file is uploaded will provide JSON Output Record you can parse:

{ "version": "0", "id": "88af1952-66fe-5fa0-ab59-9ff7a2a9e1a5", "detail-type": "AWS API Call via CloudTrail", "source": "aws.s3", "account": "811315030605", "time": "2019-07-16T02:16:12Z", "region": "us-east-1", "resources": [], "detail": { "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "AIDAIK2YZTSXMVLFWRMH2", "arn": "arn:aws:iam::811315030605:user/jbarnett", "accountId": "811315030605", "accessKeyId": "ASIA3ZZRE5JGU4DSXPUR", "userName": "jbarnett", "sessionContext": { "attributes": { "creationDate": "2019-07-15T19:28:42Z", "mfaAuthenticated": "false" } }, "invokedBy": "signin.amazonaws.com" }, "eventTime": "2019-07-16T02:16:12Z", "eventSource": "s3.amazonaws.com", "eventName": "PutObject", "awsRegion": "us-east-1", "sourceIPAddress": "156.68.176.184", "userAgent": "signin.amazonaws.com", "requestParameters": { "X-Amz-Date": "20190716T021612Z", "bucketName": "sdt-data", "X-Amz-Algorithm": "AWS4-HMAC-SHA256", "x-amz-acl": "private", "X-Amz-SignedHeaders": "content-md5;host;x-amz-acl;x-amz-storage-class", "Host": "s3.amazonaws.com", "X-Amz-Expires": "300", "key": "ceres/SYN1deg-1Hour/Terra-Aqua-MODIS_Edition4A/2018/06/CER_SYN1deg-1Hour_Terra-Aqua-MODIS_Edition4A_407406.20180601.hdf", "x-amz-storage-class": "STANDARD" }, "responseElements": null, "additionalEventData": { "SignatureVersion": "SigV4", "CipherSuite": "ECDHE-RSA-AES128-GCM-SHA256", "bytesTransferredIn": 354, "AuthenticationMethod": "QueryString", "x-amz-id-2": "BLGSosTkdNrHZwL+fBXujdFxW4US+IHJjA0/lH+rdcwyHsbwzNQq66FkFbDr4YEZRG+t3NjBXl8=", "bytesTransferredOut": 0 }, "requestID": "3952169B4B65B650", "eventID": "1a4f25e6-cb0a-4971-afd3-329d1dc0b68c", "readOnly": false, "resources": [ { "type": "AWS::S3::Object", "ARN": "arn:aws:s3:::sdt-data/ceres/SYN1deg-1Hour/Terra-Aqua-MODIS_Edition4A/2018/06/CER_SYN1deg-1Hour_Terra-Aqua-MODIS_Edition4A_407406.20180601.hdf" }, { "accountId": "811315030605", "type": "AWS::S3::Bucket", "ARN": "arn:aws:s3:::sdt-data" } ], "eventType": "AwsApiCall", "recipientAccountId": "811315030605" } }