A solution that will generate adaptive streaming urls for videos uploaded to video-source bucket. After conversion, videos will be available under module.video-cdn.cf_domain_name/file_name/protocol/file_name.protocol_extension ex. https://playground-test-video.s3.eu-central-1.amazonaws.com/IMG_6326.mov/AppleHLS1/IMG_6326.m3u8 Also there will be notifications send on endpoint under vars submit-lambda-notification-webhook and complete-lambda-notification-webhook.
By default the solution will make 3 types of conversion: HLS, DASHIS and mp4. This can be changed by modifiying video-source/converter-config-1/job-settings.json file.
Files should be uploaded to video-source/converter-config-1 and only .mp4, .mpg, .m4v, .mov, .m2ts are supported (case sensitive)
Most useful fields from 'Complete lambda' notification will be probably:
event.detail.userMetadata.guid,
event.detail.userMetadata.filename,
event.detail.status,
Important
The solution assumes that a video file will be uploaded into ...video-source
bucket with a path format:
config-name/guid/.../filename
Where guid
in the path is guid
in the notification. For example:
myVideoConfig/user1/video2
or
converter-config-1/7269c6d9-7884-4458-9f70-f142f6879a18/feed/video/28cc892d-0118-4c4c-957e-78aa39462e92
Terraform Module
module "adaptive-video" {
source = "git::ssh://[email protected]/miquido/terraform/terraform-video-converter.git?ref=tags/..."
name = "adaptive-video"
stage = var.environment
namespace = var.project
aws_region = var.aws_region
aws_used_account_no = var.aws_used_account_no
dns_alias_enabled = true
dns_alias_name = local.videos_domain
parent_zone_id = aws_route53_zone.primary.zone_id
acm_certificate_arn = local.cdn_acm_certificate_arn
// ECS task that uploads videos
uploading_service_role = module.ecs-alb-task-main-api.task_role_name
// unique endpoint from your account
mediaconvert-endpoint = "https://xxxxxxxx.mediaconvert.us-east-1.amazonaws.com"
// sends error when can't create conversion job
submit-lambda-notification-webhook = "https://${local.main_api_domain}/submit"
// sends completed job details or error object
complete-lambda-notification-webhook = "https://${local.main_api_domain}/complete"
notification-webhook-auth-header = "Api-Key ${data.aws_ssm_parameter.main-api_JOBS_API_KEY.value}"
}
Available targets:
help Help screen
help/all Display help for all targets
help/short This help short screen
lint Lint terraform code
Name | Version |
---|---|
terraform | >= 0.13 |
archive | >= 2.2.0 |
aws | ~> 3.41 |
Name | Version |
---|---|
archive | >= 2.2.0 |
aws | ~> 3.41 |
Name | Source | Version |
---|---|---|
label | git::https://github.com/cloudposse/terraform-terraform-label.git | 0.8.0 |
video-cdn | git::https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn.git | 0.82.3 |
video-source | git::https://github.com/cloudposse/terraform-aws-s3-bucket.git | 0.47.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
acm_certificate_arn | Existing ACM Certificate ARN | string |
"" |
no |
attributes | Additional attributes (e.g. 1 ) |
list(string) |
[] |
no |
aws_region | AWS Region | string |
n/a | yes |
aws_used_account_no | AWS Organization Account number used to assume role on | string |
n/a | yes |
cloudfront_price_class | Price class for video cloudfront distribution: PriceClass_All , PriceClass_200 , PriceClass_100 |
string |
"PriceClass_100" |
no |
complete-lambda-notification-webhook | endpoint for notification about conversion process | string |
n/a | yes |
delimiter | Delimiter to be used between namespace , stage , name and attributes |
string |
"-" |
no |
dns_alias_enabled | Create a DNS alias for the CDN. Requires parent_zone_id or parent_zone_name |
bool |
false |
no |
dns_alias_name | Create a DNS alias for the CDN | string |
false |
no |
mediaconvert-endpoint | your media convert endpoint | string |
n/a | yes |
name | Solution name, e.g. 'app' or 'cluster' | string |
"app" |
no |
namespace | Namespace, which could be your organization name, e.g. 'eg' or 'cp' | string |
n/a | yes |
notification-webhook-auth-header | webhook authorization header | string |
"" |
no |
parent_zone_id | ID of the hosted zone to contain this record (or specify parent_zone_name ). Requires dns_alias_enabled set to true |
string |
"" |
no |
stage | Stage, e.g. 'prod', 'staging', 'dev', or 'test' | string |
n/a | yes |
submit-lambda-notification-webhook | endpoint for notification about errors | string |
n/a | yes |
tags | Additional tags (e.g. map('BusinessUnit','XYZ') |
map(string) |
{} |
no |
uploading_service_role | Role of the service that will upload videos | string |
"" |
no |
No outputs.
-
Make changes in terraform files
-
Regenerate documentation
bash <(git archive [email protected]:miquido/terraform/terraform-readme-update.git master update.sh | tar -xO)
-
Run lint
make lint
Copyright © 2017-2022 Miquido