Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Edit/Custom MediaConvertStatus Function #297

Open
aexei opened this issue Jul 28, 2021 · 2 comments
Open

Edit/Custom MediaConvertStatus Function #297

aexei opened this issue Jul 28, 2021 · 2 comments

Comments

@aexei
Copy link

aexei commented Jul 28, 2021

Hey all,

The new function with the SNS Topic is great. How can I customize the Lambda function or automatically assign a Lambda function to the topic as a subscriber?

I already customized "pSnsTopicName" in "parameters.json", but unfortunately the TopicName doesn't change and I can't reference the original name in a function either. Because "MediaConvertNotificationsSNS" is not in the outputs of the video category.

Many greetings
Alex

@shamikatamazon
Copy link
Contributor

shamikatamazon commented Aug 18, 2021

Hi Aexei - Firstly apologies for the delayed response to your questions.
#1 - In order to change the name of the SNS Topic - you can edit provider-utils/awscloudformation/cloudformation-templates/vod-workflow-template.yaml.ejs and change the Default Value under pSnsTopicName

#2 - You have a few options to update the Lamda code - You can update the file provider-utils/awscloudformation/cloudformation-templates/vod-helpers/LambdaFunctions/MediaConvertStatusLambda/index.js with your custom code or alternatively update your code in the console for the MediaConvertStatusLambda. If you'd prefer to write your own Lambda and hook it to the SNS Topic, you'll need to define your own Lambda and code and then add in the Lambda->SNS permission and Lambda->SNS subscription

rSNSLambdaPermissions:
Type: AWS::Lambda::Permission
Properties:
FunctionName: !Ref rMediaconvertStatusLambda
Action: lambda:InvokeFunction
Principal: sns.amazonaws.com
SourceArn: !Sub arn:aws:sns:${AWS::Region}:${AWS::AccountId}:*

rSNSLambdaSubscription:
Type: AWS::SNS::Subscription
Properties:
Protocol: lambda
Endpoint: !GetAtt rMediaconvertStatusLambda.Arn
TopicArn: !Ref MediaConvertNotificationsSNS

Hopefully this helps! Please let me know if you have any additional questions.

@wmccracken
Copy link

Hi Aexei - Firstly apologies for the delayed response to your questions. #1 - In order to change the name of the SNS Topic - you can edit provider-utils/awscloudformation/cloudformation-templates/vod-workflow-template.yaml.ejs and change the Default Value under pSnsTopicName

#2 - You have a few options to update the Lamda code - You can update the file provider-utils/awscloudformation/cloudformation-templates/vod-helpers/LambdaFunctions/MediaConvertStatusLambda/index.js with your custom code or alternatively update your code in the console for the MediaConvertStatusLambda. If you'd prefer to write your own Lambda and hook it to the SNS Topic, you'll need to define your own Lambda and code and then add in the Lambda->SNS permission and Lambda->SNS subscription

Hi - following up on this, I've got a similar issue. The solutions that you provided are not very portable as they require modifications to the amplify-video package itself or require manually editing the function in the AWS Console. Is there a plan or existing solution that would allow the notification lambda to be modified in the project and checked into version control? I really like the features that amplify video provides but I need to update records in my model when video processing completes and there is no easy way to do this and deploy across multiple environments at this time.

Thanks,

Will

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants