Unlike the upload only demo, provisioning for this demo
is harder because it's not yet possible to automate all the steps with
Terraform. There is a configuration under src/main/terraform
but it's not
complete (it lacks Elastic Transcoder support).
-
Change into
src/main/terraform
under the demo directory. -
Set the following environment variables:
TF_VAR_AWS_SECRET_KEY
TF_VAR_AWS_ACCESS_KEY
-
Configure the remaining AWS variables in
variables.tf
. -
Disable the Lambda config:
mv aws_lambda.tf aws_lambda.tf.disabled
-
Run the following to check all is well:
terraform plan
-
Apply the config:
terraform apply
-
Log in to the AWS console and create an Elastic Transcoder pipeline. It needs to read from and write to the S3 buckets created by Terraform. Note the pipeline ID once it is created.
-
Update
src/main/js/index.js
with the pipeline ID. -
Re-enable the Terraform Lambda config, in
src/main/terraform
:mv aws_lambda.tf.disabled aws_lambda.tf
-
Run the plan again to check all is well:
terraform plan
-
Apply the remaining config:
terraform apply
-
In the S3 Console, open the input bucket's properties. Change the Events sections and add a notification on
ObjectCreated
to call the lambda created above.
-
Edit
src/main/resources/application.properties
to set the appropriate values. -
Run maven with
mvn
. -
Navigate to http://localhost:8080/.
-
Upload a video.
-
After a short delay, check the Elastic Transcoder console to see if a job has been scheduled. If not, check the Lamba console and see if there were any errors.