#!/usr/bin/env bash # Import configuration . ./.env MEDIA_CONVERT_ENDPOINT=$(aws mediaconvert describe-endpoints --query Endpoints[0].Url | xargs) # Build the fanout lambda cd functions/fanout-lambda make build cd .. # Build the media-lambda cd media-lambda make build cd ../.. cd cloudformation echo "validating cloudformation templates" aws cloudformation validate-template \ --template-body file://fanout-lambda.yml aws cloudformation validate-template \ --template-body file://media-lambda.yml aws cloudformation validate-template \ --template-body file://dynamodb.yml aws cloudformation validate-template \ --template-body file://main.yml aws cloudformation validate-template \ --template-body file://tasks.yml aws cloudformation validate-template \ --template-body file://vpc.yml aws cloudformation package \ --template-file ./fanout-lambda.yml \ --s3-bucket $CFN_BUCKET \ --output-template-file ./fanout-lambda.pkg.yml aws cloudformation package \ --template-file ./media-lambda.yml \ --s3-bucket $CFN_BUCKET \ --output-template-file ./media-lambda.pkg.yml aws cloudformation package \ --template-file ./main.yml \ --s3-bucket $CFN_BUCKET \ --output-template-file ./main.pkg.yml aws cloudformation deploy \ --template-file ./main.pkg.yml \ --stack-name $STACK_NAME \ --parameter-overrides \ MediaConvertEndpoint=$MEDIA_CONVERT_ENDPOINT \ EnvironmentSuffix=$ENVIRONMENT_SUFFIX \ --capabilities CAPABILITY_IAM cd .. aws cloudformation describe-stacks \ --stack-name $STACK_NAME \ --query Stacks[0].Outputs > stack-outputs.ignore.json python <