awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Referencing video CF outputs #259

Open danielvouch opened 3 years ago

danielvouch commented 3 years ago

Which Category is your question related to? Amplify Video

Provide additional details e.g. code snippets We need to reference our input bucket name in a lambda function, we have added a dependency in the backend-config.json file as follows with our video project name in place of ".

 {
    "category": "video",
    "resourceName": "<video_resource_name>",
    "attributes":  [
         "oVODInputS3"
    ]
}

We then added a parameter into our lambda CF template with the format .

"video<resource_name>oVODInputS3": {
     "Type": "String",
}

When pushing the changes up we are getting the following error

UPDATE_FAILED functionvcontroller AWS::CloudFormation::Stack Mon May 17 2021 16:43:09 GMT+1000 (Australian Eastern Standard Time) Parameters: [video<resource_name>VODInputS3] must have values

Is this the correct way to be referencing the outputs?

danielvouch commented 3 years ago

Update on this - after updating to the newest version of amplify-category-video this now works for oVODInputS3 attribute.

However, when creating a custom directory and adding a new output attribute (oVODInputS3Arn) in the workflow-template we are getting the following error when pushing to the cloud - Output 'oVODInputS3Arn' not found in stack

Outputs:
  oVODInputS3:
    Description: Put source video here for processing and hosting by Amplify Video
    Value: !GetAtt rS3InputBucket.Outputs.oInputBucketName
  oVODInputS3Arn:
    Description: ARN for input bucket
    Value: !GetAtt rS3InputBucket.Outputs.oInputBucketArn
  oVODOutputS3:
    Description: Amplify Video hosts transcoded video content in this bucket
    Value: !GetAtt rS3OutputBucket.Outputs.oOutputBucketName
  oVodOutputUrl:
    Description: Amplify Video CloudFront Url
    Value: !GetAtt rCloudfrontDistribution.Outputs.oCFDomain

It doesn’t seem like the workflow-template is being overwritten in the build directory?

danielvouch commented 3 years ago

@wizage Any help with this would be really appreciated 🙏

danielvouch commented 3 years ago

Any update on this by any chance, I have just updated to the latest version and am still getting the same error.

wizage commented 3 years ago

I haven't taken a look at this. I have to look at how Amplify passes variables. I might have a solution. Will take a stab tomorrow

danielvouch commented 3 years ago

Thanks @wizage really appreciate it, please let me know how I can help.

After updating to the latest amplify and amplify-video version I am getting the following error when pushing changes.

UPDATE_FAILED <lambdafunction> AWS::CloudFormation::Stack Tue Jun 22 2021 09:54:48 GMT+1000 (Australian Eastern Standard Time) Output 'oVODInputS3Arn' not found in stack 'arn:aws:cloudformation:ap-southeast-2:237348163393:stack/amplify-<project-name>-124904-<video-resource-name>-WS0BIQS2C7XS/7c7f2210-928e-11eb-96fb-0accb46fa7d2'

To just give you context as to why we are doing this, we are getting users to record multiple videos (where they can re-record responses as well) - currently on submission of the recordings we upload all recordings at once and hit some concurrency issues where we hit the limit for MediaConvert api calls (429 responses).

Ideally we would upload to s3 as recordings come in and then when our submission api is called kick off the MediaConvert jobs.

smp commented 3 years ago

HI @danielvouch, have you requested a limit increase from the service team? The API throttles are soft and can be increased with a request. MediaConvert has it's own "queueing" mechanisms internally, so we shouldn't need to build them outside of the service if we can avoid it :)

https://docs.aws.amazon.com/general/latest/gr/mediaconvert.html

danielvouch commented 3 years ago

Thanks @smp, I did look into that but based on our recording workflow we only want to trigger mediaconvert jobs once the user submits their response rather than on input to the s3 bucket.

We want to upload each individual recording to s3 as they happen rather uploading all of the recordings on submission so that the final submission process is as fast as possible.

Sorry @smp @wizage I should’ve explained that in original explanation :).

danielvouch commented 3 years ago

@wizage Have you had a look at this by any chance?

danielvouch commented 3 years ago

Thanks @smp, I did look into that but based on our recording workflow we only want to trigger mediaconvert jobs once the user submits their response rather than on input to the s3 bucket.

We want to upload each individual recording to s3 as they happen rather uploading all of the recordings on submission so that the final submission process is as fast as possible.

Sorry @smp @wizage I should’ve explained that in original explanation :).

@wizage @smp Do you have any other suggestions how we can leverage amplify video to achieve our desired workflow?

danielvouch commented 2 years ago

Hi @smp @wizage - I commented on a related post but really wanted to see if there was anyway to customise the main CF template for the video category?