Appendix G: Amazon SNS Notifications - Media2Cloud

Appendix G: Amazon SNS Notifications

The Media2Cloud solution sends Amazon Simple Notification Service (Amazon SNS) a publish notification to the subscriber when the ingest, analysis, and labeling state machines are completed, or when there is an error. You can automate other workflows such as importing data to a Media Asset Management (MAM) system by using the Amazon SNS topic subscription created by the solution. The following JSON notification messages can be customized to your needs.

Ingest State Machine Notification Message

{ "operation": "job-completed", "input": { "src": { "bucket": "<ingest-bucket>", "key": "demo-02/demo-02.mp4", "type": "video" }, "restore": { "startTime": 1572428433387, "endTime": 1572428433387 }, "checksum": { "algorithm": "md5", "fileSize": 5885585, "computed": "f0c34a09ab84db214e4c7bd6a164e5e9", "storeChecksumOnTagging": true, "startTime": 1572428434655, "endTime": 1572428434969, "comparedWith": "object-metadata", "comparedResult": "MATCHED", "tagUpdated": true }, "mediainfo": { "output": "<uuid>/demo-02/mediainfo/output.xml" }, "transcode": { "jobId": "1572428437358-yjfe1o", "destination": "<uuid>/demo-02/transcoded/" }, "indexer": { "terms": [ "lastModified", "timestamp", "basename", "fileSize", "mime", "mediainfo", "uuid", "key", "type", "md5" ] } }, "progress": 0, "uuid": "<uuid>", "status": "COMPLETED", "stateMachine": "SO0050-m2csolution-ingest" }
Key Name Description
operation Last state of the state machine: job-completed
status Status of the state machine: COMPLETED
stateMachine Ingest state machine name
uuid UUID of the file
progress Progress of the state machine
input Input parameters
input.src.bucket Ingest bucket where the uploaded file is stored
input.src.key Object key of the uploaded file
input.src.type Major type of the uploaded file: image or video
input.restore.startTime If object is in GLACIER or DEEP_ARCHIVE storage, startTime indicates the start time of the restore process
input.restore.endTime If object is in GLACIER or DEEP_ARCHIVE storage, endTime indicates the end time of the restore process
input.checksum.algorithm Checksum algorithm type: md5 or sha1
input.checksum.fileSize File size of the uploaded file
input.checksum.computed The computed MD5 or SHA1 checksum
input.checksum.storeChecksumOnTagging A flag indicates if the checksum value is stored in Amazon S3 object tagging
input.checksum.startTime Start time of the checksum process
input.checksum.endTime End time of the checksum process
input.checksum.comparedWith indicates how we compare the “computed” checksum

object-metadata refers to x-amz-metadat-md5 is used for comparison

object-tagging refers to an existing “computed-md5” object tag is used for comparison

object-etag refers to the object ETag value is used for comparison

input.checksum.comparedResult Result of the checksum comparison: MATCHED, NOTMATCHED, SKIPPED
input.checksum.tagUpdated Indicate if the solution successfully updates the object tagging with the computed checksum value
input.mediainfo.output Location of the raw mediainfo XML output in proxy bucket
input.transcode.jobId AWS Elemental MediaConvert Job ID when the solution creates proxies
input.transcode.destination Location of the transcoded proxies in proxy bucket
indexer.terms A list of terms indexed to Amazon Elasticsearch cluster

Analysis State Machine Notification Message

If all retries fail, the state machine generates an error to stop the execution. Amazon CloudWatch Events is configured to monitor for errors generated by the state machines. The CloudWatch Events pattern is defined as follows:

{ "operation": "job-completed", "progress": 0, "uuid": "<uuid>", "status": "COMPLETED", "stateMachine": "SO0050-m2csolution-analysis", "input": { "aiOptions": { "celeb": true, "face": true, "faceMatch": true, "label": true, "moderation": true, "person": true, "text": true, "transcript": true, "entity": true, "keyphrase": true, "sentiment": true, "topic": true, "document": false, "languageCode": "en-US", "customVocabulary": "your-custom-vocabulary-en-US", "faceCollectionId": "your-rekognition-face-collection", "minConfidence": 80, "classification": false }, "video": { "arn": "02b386b2-cdc0-4a36-a01c-4ec55a899e93", "status": "COMPLETED", "startTime": 1572428774779, "endTime": 1572428933323, "rekognition": { "celeb": { "id": "4d433218929e11fbf8d9af64f47aa6b0606e69c739158af3387027d6926329b6", "startTime": 1572428777012, "endTime": 1572428899621, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/celeb/output.json", "vtt": "<uuid>/demo-02/analysis/vtt/celeb", "metadata": "<uuid>/demo-02/analysis/metadata/celeb" }, "face": { "id": "7687e0a9edacf7dc5158a49cf9ff19c2f1238d2d4b5f7bf50e0a4c9b89df36be", "startTime": 1572428776935, "endTime": 1572428850747, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/face/output.json" }, "faceMatch": { "id": "f094dee814a3e5f7614bb194eb7405803efd8a10ee56e72d001fc3d93b2ffccf", "startTime": 1572428777211, "endTime": 1572428875221, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/faceMatch/output.json", "vtt": "<uuid>/demo-02/analysis/vtt/faceMatch", "metadata": "<uuid>/demo-02/analysis/metadata/faceMatch" }, "label": { "id": "05599be024bcf05e65c5c219126af60926bb614ef06881530b677734ac45e3a7", "startTime": 1572428777002, "endTime": 1572428923922, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/label/output.json", "vtt": "<uuid>/demo-02/analysis/vtt/label", "metadata": "<uuid>/demo-02/analysis/metadata/label" }, "moderation": { "id": "11f9cfea6c4b520168b47daab9d715af3dd8e254fb37b285acce0e29631ccafb", "startTime": 1572428777110, "endTime": 1572428850940, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/moderation/output.json", "vtt": "<uuid>/demo-02/analysis/vtt/moderation", "metadata": "<uuid>/demo-02/analysis/metadata/moderation" }, "person": { "id": "60e0be718f730798fd58c101122acea363a53d1994bd5b8f528a994825d4fb08", "startTime": 1572428776997, "endTime": 1572428875010, "output": "<uuid>/demo-02/analysis/raw/20191030T094613/rekognition/person/output.json", "vtt": "<uuid>/demo-02/analysis/vtt/person", "metadata": "<uuid>/demo-02/analysis/metadata/person" } } }, "audio": { "arn": "1c305972-623c-4474-b822-f3ce149e1226", "status": "COMPLETED", "startTime": 1572428774757, "endTime": 1572428829213, "comprehend": { "entity": { "startTime": 1572431779336, "endTime": 1572431779937, "output": "<uuid>/demo-02/analysis/raw/20191030T103413/comprehend/entity/output.json", "metadata": "<uuid>/demo-02/analysis/metadata/entity/output.json" }, "keyphrase": { "startTime": 1572431779467, "endTime": 1572431780598, "output": "<uuid>/demo-02/analysis/raw/20191030T103413/comprehend/keyphrase/output.json", "metadata": "<uuid>/demo-02/analysis/metadata/keyphrase/output.json" }, "sentiment": { "startTime": 1572431779533, "endTime": 1572431780613, "output": "<uuid>/demo-02/analysis/raw/20191030T103413/comprehend/sentiment/output.json", "metadata": "<uuid>/demo-02/analysis/metadata/sentiment/output.json" } }, "transcribe": { "name": "<uuid>_19aceb4c20e2f0bc", "output": "<uuid>/demo-02/analysis/raw/20191030T094613/transcribe/output.txt", "startTime": 1572428776512, "endTime": 1572428824917, "vtt": "<uuid>/demo-02/analysis/vtt/transcribe/output.vtt" } }, "image": { "status": "NOT_STARTED" }, "document": { "status": "NOT_STARTED" }, "metrics": { "duration": 1000, "requestTime": 1572428773178, "startTime": 1572428774806, "endTime": 1572428940375 }, "indexer": { "terms": [ "celeb", "faceMatch", "label", "entity", "keyphrase", "sentiment" ] } } }
Key Name Description
operation Last state of the state machine: job-completed
status Status of the state machine: COMPLETED
stateMachine Analysis state machine name
uuid UUID of the file
progress Progress of the state machine
input Input parameters
input.aiOptions Indicate the AI/ML options used for the analysis process
input.aiOptions.celeb Boolean value indicates if Celebrity detection is enabled
input.video Video analysis information
input.video.arn Video analysis state machine execution ARN
input.video.status Status of the video analysis process
input.video.startTime Start time of the video analysis process
input.video.endTime End time of the video analysis process
input.video.rekognition Amazon Rekognition results
input.video.rekognition.celeb Amazon Rekognition Celebrity Recognition result
input.video.rekognition.celeb.id Amazon Rekognition Celebrity Recognition Job ID
input.video.rekognition.celeb.startTime Start time of the Celebrity Recognition process
input.video.rekognition.celeb.endTime End time of the Celebrity Recognition process
input.video.rekognition.celeb.output Location of the raw results from Celebrity Recognition process stored in proxy bucket
input.video.rekognition.celeb.vtt Location of the WebVTT tracks the solution generated stored in proxy bucket
input.video.rekognition.celeb.metadata Location of the metadata tracks the solution generated stored in proxy bucket
input.video.rekognition.face Amazon Rekognition Face Detection result
input.video.rekognition.faceMatch Amazon Rekognition Face Search result
input.video.rekognition.label Amazon Rekognition Label Detection result
input.video.rekognition.moderation Amazon Rekognition Moderation Detection result
input.video.rekognition.person Amazon Rekognition Person Pathing result
input.audio Audio analysis results
input.audio.arn Audio analysis state machine execution ARN
input.audio.status Status of the audio analysis process
input.audio.startTime Start time of the audio analysis process
input.audio.endTime End time of the audio analysis process
input.audio.transcribe Amazon Transcribe results
input.audio.transcribe.name Amazon Transcribe Job name
input.audio.transcribe.output Location of the raw results from Amazon Transcribe service stored in proxy bucket
input.audio.transcribe.startTime Start time of the transcribe process
input.audio.transcribe.endTime End time of the transcribe process
input.audio.transcribe.vtt Location of the WebVTT tracks the solution generated, stored in proxy bucket
input.audio.comprehend Amazon Comprehend results
input.audio.comprehend.entity Amazon Comprehend Entity Detection results
input.audio.comprehend.entity.startTime Start time of Entity Detection process
input.audio.comprehend.entity.endTime End time of Entity Detection process
input.audio.comprehend.entity.output Location of the raw results from Entity Detection process, stored in proxy bucket
input.audio.comprehend.entity.metadata Location of the metadata tracks the solution generated, stored in proxy bucket
input.audio.comprehend.keyphrase Amazon Comprehend Key Phrases Detection results
input.audio.comprehend.sentiment Amazon Comprehend Sentiment Detection results
input.image Image analysis results
input.metrics Overall statistic of analysis process
input.indexer.terms A list of terms indexed to Amazon Elasticsearch Service cluster

Labeling State Machine Notification Message

{ "operation": "job-completed", "input": { "dataset": { "manifestUri": "s3://<proxy-bucket>/ground-truth/<uuid>/demo-02/transcoded/aiml/20191016T141758.manifest", "templateUri": "s3://<proxy-bucket>/ground-truth/<uuid>/demo-02/transcoded/aiml/20191016T141758.liquid", "items": [ "a0fa5d7e-2bba-ffaf-4113-0b0bacc8f98d" ] }, "labeling": { "name": "<uuid>-20191016T141758", "arn": "arn:aws:sagemaker:eu-west-1:255655562678:labeling-job/<uuid>-20191016t141758", "taskStatus": "COMPLETED", "outputUri": "s3://<proxy-bucket>/ground-truth/<uuid>/demo-02/transcoded/aiml/<uuid>-20191016T141758/manifests/output/output.manifest", "faceIds": [ "d60a57f4-c486-4541-80aa-9e20712dc999" ] } }, "progress": 0, "uuid": "<uuid>", "status": "COMPLETED", "stateMachine": "SO0050-m2csolution-gt-labeling" }
Key Name Description
operation Last state of the state machine: job-completed
status Status of the state machine: COMPLETED
stateMachine Labeling state machine name
uuid UUID of the file
progress Progress of the state machine
input Input parameters
input.dataset Labeling job dataset information
input.dataset.manifestUri Location of a JSON document contains the source reference of the images to be labeled
input.dataset.templateUri Location of a custom HTML liquid template that is presented to the labeling workers
input.dataset.items A list of UUIDs to identify the cropped faces in a DynamoDB table
input.labeling Labeling job information
input.labeling.name Amazon SageMaker Ground Truth Labeling job name
input.labeling.arn Amazon SageMaker Ground Truth Labeling job ARN
input.labeling.taskStatus Labeling job/task status
input.labeling.outputUri Location of the raw annotation results from the labeling job
input.labeling.faceIds A list of UUIDs of the faces that are added to your Amazon Rekognition Face Collection by the solution

State Machine Error Notification Message

{ "uuid": "<uuid>", "stateMachine": "SO0050-m2csolution-gt-labeling", "status": "ERROR", "errorMessage": "Cannot destructure property `workerId` of 'undefined' or 'null'.", "input": { "uuid": "<uuid>" } }
Key Name Description
uuid UUID of the file
stateMachine The state machine that generated the error
status ERROR
errorMessage The detailed error message
input The input parameter used to start the state machine