---
title: Terraform support for job templates and output presets of AWS Elemental MediaConvert
description: Use Terraform to manage AWS Elemental MediaConvert job templates and output presets for consistent, automated video workflows.
image: https://www.craftsmensoftware.com/hubfs/AWS_Lambda_Intregation-2.webp
---

[Skip to main content](https://www.craftsmensoftware.com/blog/terraform-support-for-job-templates-and-output-presets-of-aws-elemental-mediaconvert#main-content)

[![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png) ![Craftsmen-logo](https://www.craftsmensoftware.com/hs-fs/hubfs/Website%202.png?width=200&height=72&name=Website%202.png)](https://www.craftsmensoftware.com)

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)

Open main navigation

Close main navigation

- [About us](https://www.craftsmensoftware.com/about-us)
- [Client Stories](https://www.craftsmensoftware.com/client-success-stories)
- [How We Work](https://www.craftsmensoftware.com/how-we-work)
- [Case Study](https://www.craftsmensoftware.com/case-study)
- [Blog](https://www.craftsmensoftware.com/blog)
- [Career](https://careers.craftsmensoftware.com/)
- [Get In Touch](https://www.craftsmensoftware.com/contact-us)

[Get In Touch](https://www.craftsmensoftware.com/contact-us)

## Terraform support for job templates and output presets of AWS Elemental MediaConvert

![Terraform support for job templates and output presets of AWS Elemental MediaConvert](https://www.craftsmensoftware.com/hs-fs/hubfs/AWS_Lambda_Intregation-2.webp?width=1200&height=820&name=AWS_Lambda_Intregation-2.webp)

AWS Elemental MediaConvert is a media transcoding service of AWS. For supporting vast VOD service, MediaConvert is very useful and reliable. Terraform is an Infrastructure as Code (IaC) tool which supports multiple Cloud platforms like AWS, Azure, and GCP. Unfortunately due to a lot of configurations of MediaConvert, terraform does not support MediaConvert resource and settings management yet. In this tutorial, we are going to take a look at how can we achieve this.

## MediaConvert Job Templates

![1](https://www.craftsmensoftware.com/hs-fs/hubfs/1.png?width=700&height=557&name=1.png)

The job template is a part of MediaConvert. If we create some templates with input(s) and output(s) of transcoding, we can use that for every time to transcoding some files. Let’s say your platform needs 3 types of video outputs with different bitrate and resolution. So we can save that template and reuse for the next transcoding jobs. There is another section called **Output presets** in MediaConvert console. These preset store output configurations of transcoding jobs. And in the template, we can use one or more output presets.

## Setting the Goal

So our plan is to manage MediaConvert templates with terraform as terraform does not support MediaConvert. So we will create templates and output presets at the time of **Terraform apply** command and destroy with **Terraform destroy** command.

## MediaConvert presets and template

For the MediaConvert preset, we will use one preset for video and one preset for audio for simplicity. And we will use [MS Smooth streaming](https://www.microsoft.com/silverlight/smoothstreaming/) protocol for transcoding.

A1 — Audio preset P1 — Video preset

{  
  "Name": "A1",  
  "Settings": {  
    "AudioDescriptions": \[  
      {  
        "AudioTypeControl": "FOLLOW\_INPUT",  
        "AudioSourceName": "Audio Selector 1",  
        "CodecSettings": {  
          "Codec": "AAC",  
          "AacSettings": {  
            "AudioDescriptionBroadcasterMix": "NORMAL",  
            "Bitrate": 128000,  
            "RateControlMode": "CBR",  
            "CodecProfile": "LC",  
            "CodingMode": "CODING\_MODE\_2\_0",  
            "RawFormat": "NONE",  
            "SampleRate": 48000,  
            "Specification": "MPEG4"  
          }  
        },  
        "LanguageCodeControl": "FOLLOW\_INPUT"  
      }  
    \],  
    "ContainerSettings": {  
      "Container": "ISMV"  
    }  
  }  
}

{  
  "Name": "P1",  
  "Settings": {  
    "VideoDescription": {  
      "Width": 192,  
      "ScalingBehavior": "DEFAULT",  
      "Height": 108,  
      "VideoPreprocessors": {  
        "Deinterlacer": {  
          "Algorithm": "INTERPOLATE",  
          "Mode": "DEINTERLACE",  
          "Control": "NORMAL"  
        }  
      },  
      "TimecodeInsertion": "DISABLED",  
      "AntiAlias": "ENABLED",  
      "Sharpness": 50,  
      "CodecSettings": {  
        "Codec": "H\_264",  
        "H264Settings": {  
          "InterlaceMode": "PROGRESSIVE",  
          "NumberReferenceFrames": 1,  
          "Syntax": "DEFAULT",  
          "Softness": 0,  
          "GopClosedCadence": 1,  
          "HrdBufferInitialFillPercentage": 100,  
          "GopSize": 48,  
          "Slices": 1,  
          "GopBReference": "DISABLED",  
          "HrdBufferSize": 112000,  
          "SlowPal": "DISABLED",  
          "SpatialAdaptiveQuantization": "DISABLED",  
          "TemporalAdaptiveQuantization": "DISABLED",  
          "FlickerAdaptiveQuantization": "DISABLED",  
          "EntropyEncoding": "CAVLC",  
          "Bitrate": 112000,  
          "FramerateControl": "INITIALIZE\_FROM\_SOURCE",  
          "RateControlMode": "CBR",  
          "CodecProfile": "BASELINE",  
          "Telecine": "NONE",  
          "MinIInterval": 0,  
          "AdaptiveQuantization": "OFF",  
          "CodecLevel": "LEVEL\_3",  
          "FieldEncoding": "PAFF",  
          "SceneChangeDetect": "ENABLED",  
          "QualityTuningLevel": "SINGLE\_PASS",  
          "FramerateConversionAlgorithm": "DUPLICATE\_DROP",  
          "UnregisteredSeiTimecode": "DISABLED",  
          "GopSizeUnits": "FRAMES",  
          "ParControl": "INITIALIZE\_FROM\_SOURCE",  
          "NumberBFramesBetweenReferenceFrames": 0,  
          "RepeatPps": "DISABLED"  
        }  
      },  
      "AfdSignaling": "NONE",  
      "DropFrameTimecode": "ENABLED",  
      "RespondToAfd": "NONE",  
      "ColorMetadata": "IGNORE"  
    },  
    "ContainerSettings": {  
      "Container": "ISMV"  
    }  
  }  
}

For the MediaConvert job template, we are going to use the following configuration. The presets A1 and P1 are mentioned in MS Smooth output settings.

{  
  "Description": "Test VOD Material",  
  "Name": "test\_vod",  
  "Settings": {  
    "OutputGroups": \[  
      {  
        "Name": "MS Smooth",  
        "Outputs": \[  
          {  
            "Preset": "A1"  
          },  
          {  
            "Preset": "P1"  
          }  
        \],  
        "OutputGroupSettings": {  
          "Type": "MS\_SMOOTH\_GROUP\_SETTINGS",  
          "MsSmoothGroupSettings": {  
            "FragmentLength": 2,  
            "ManifestEncoding": "UTF8",  
            "AudioDeduplication": "COMBINE\_DUPLICATE\_STREAMS"  
          }  
        }  
      }  
    \],  
    "AdAvailOffset": 0,  
    "Inputs": \[  
      {  
        "AudioSelectors": {  
          "Audio Selector 1": {  
            "Offset": 0,  
            "DefaultSelection": "DEFAULT",  
            "ProgramSelection": 1  
          }  
        },  
        "VideoSelector": {  
          "ColorSpace": "FOLLOW",  
          "Rotate": "DEGREE\_0"  
        },  
        "FilterEnable": "AUTO",  
        "PsiControl": "USE\_PSI",  
        "FilterStrength": 0,  
        "DeblockFilter": "DISABLED",  
        "DenoiseFilter": "DISABLED",  
        "TimecodeSource": "EMBEDDED"  
      }  
    \]  
  },  
  "AccelerationSettings": {  
    "Mode": "DISABLED"  
  },  
  "StatusUpdateInterval": "SECONDS\_60",  
  "Priority": 0,  
  "HopDestinations": \[\]  
}

 Copy

 

## Terraform Configs

For each AWS region, there is a separate MediaConvert endpoint URL. Our first goal is to grab that endpoint URL because to get create preset and template we need MediaConvert endpoint URL. We are going to use AWS CLI for that. Let’s install that from [here](https://aws.amazon.com/cli/). Then we will write a simple bash script to grab the MediaConvert endpoint URL. We need to format the output with jq — A JSON processor (will explain why after some moments). Let’s install jq from [here](https://stedolan.github.io/jq/). Then our script will be like this in **mediaconvert\_url.sh** file.

\# mediaconvert\_url.sh  
#!/bin/bash  
set -e  
eval "$(jq -r '@sh "export profile=\\(.profile) region=\\(.region)"')"  
aws mediaconvert describe-endpoints --profile "$profile" --region "$region" | jq -r .Endpoints\[0\]  
Don’t forget to run

chmod a+x mediaconvert\_url.sh  
Now lets set AWS provider in provider.tf

\# provider.tf  
provider "aws" {  
  region = "eu-west-1"  
  profile = local.aws\_profile  
}  
locals {  
//  This profile name used in multiple places  
//  So keeping it in a local var  
  aws\_profile = "your-aws-profile"  
}  
// For getting AWS region dynamically  
data "aws\_region" "current" {}

 Copy

 

Now we have to pass the AWS profile set by us and region to **mediaconvert\_url.sh** to get the MediaConvert endpoint URL. So we are going to use an [external data source of Terraform](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source) and run the **mediaconvert\_url.sh.** But terraform external data source only accepts JSON formatted output. That’s why we are using jq to format the output of the **AWS MediaConvert describe-endpoints** command. Let’s add an external terraform source in **mediaconvert\_url.tf** 

\# mediaconvert\_url.tf

locals {  
//  Keeping the mediaconvert endpoint URL to a local var  
  mediaconvert\_endpoint = data.external.mediaconvert\_endpoint.result.Url  
}  
// Run external program using terraform's data external  
data "external" "mediaconvert\_endpoint" {  
  program = \["/bin/bash", "-c", "${path.module}/mediaconvert\_url.sh"\]  
  query = {  
    profile = local.aws\_profile  
    region = data.aws\_region.current.name  
  }  
}  
// Terraform output - mediaconvert URL  
output "mediaconvert\_endpoint" {  
  value = local.mediaconvert\_endpoint  
}

 Copy

 

Now let’s keep our presets in presets directory and MediaConvert templates in templates directory like this

So we will use AWS CLI to create presets and job templates. But we will add this using a bash script. Also, our same bash script will be used to destroy. So a flag ACTION will be used to differentiate between creating and destroying. The script will look like this in mediaconvert.sh file.

\# mediaconvert.sh  
#!/bin/bash  
find presets/\* -prune -type f | while IFS= read -r preset; do  
  echo "$preset"  
  PRESET\_NAME=$(jq -r '.Name' "$preset")  
  PRESET\_SETTINGS=$(jq '.Settings' "$preset")  
  if \[ "$ACTION" = "destroy" \]; then  
      aws mediaconvert delete-preset \\  
      --name "$PRESET\_NAME" \\  
      --endpoint-url "$MEDIACONVERT\_URL" \\  
      --profile "$AWS\_PROFILE" \\  
      --region "$REGION"  
  else  
      aws mediaconvert create-preset \\  
      --name "$PRESET\_NAME" \\  
      --settings "$PRESET\_SETTINGS" \\  
      --endpoint-url "$MEDIACONVERT\_URL" \\  
      --profile "$AWS\_PROFILE" \\  
      --region "$REGION"  
  fi  
done  
find templates/\* -prune -type f | while IFS= read -r template; do  
  echo "$template"  
  TEMPLATE\_NAME=$(jq -r '.Name' "$template")  
  TEMPLATE\_SETTINGS=$(jq '.Settings' "$template")  
  if \[ "$ACTION" = "destroy" \]; then  
      aws mediaconvert delete-job-template \\  
      --name "$TEMPLATE\_NAME" \\  
      --endpoint-url "$MEDIACONVERT\_URL" \\  
      --profile "$AWS\_PROFILE" \\  
      --region "$REGION"  
  else  
      aws mediaconvert create-job-template \\  
      --name "$TEMPLATE\_NAME" \\  
      --settings "$TEMPLATE\_SETTINGS" \\  
      --endpoint-url "$MEDIACONVERT\_URL" \\  
      --profile "$AWS\_PROFILE" \\  
      --region "$REGION"  
  fi  
done

 Copy

 

  Also, don’t forget to run 

chmod a+x mediaconvert.sh

 Copy

 

As we can see that we have to pass environment variables ACTION, MEDIACONVERT\_URL, AWS\_PROFILE, and REGION. To do this we are going to use a [local-exe](https://www.terraform.io/docs/provisioners/local-exec.html)c provisioner of Terraform in a [null resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource). We are going to add 2 provisioner — one to create presets and template and another for destroy. And we will pass environment vars of **mediaconvert.sh** from this provisioners. Let’s do it in **mediaconvert.tf** file.

\# mediaconvert.tf  
resource "null\_resource" "mediaconvert\_creation" {  
  //Provisioner for creation  
  provisioner "local-exec" {  
    when    = create  
    command = "./${path.module}/mediaconvert.sh"  
    environment = {  
      ACTION           = "create"  
      AWS\_PROFILE      = local.aws\_profile  
      REGION           = data.aws\_region.current.name  
      MEDIACONVERT\_URL = local.mediaconvert\_endpoint  
    }  
  }  
    // Provisioner for destroying  
    provisioner "local-exec" {  
      when = destroy  
      command = "./${path.module}/mediaconvert.sh"  
      environment = {  
        ACTION = "destroy"  
        AWS\_PROFILE = local.aws\_profile  
        REGION = data.aws\_region.current.name  
        MEDIACONVERT\_URL = local.mediaconvert\_endpoint  
      }  
    }  
}

 Copy

 

```
Finally, our project will look like this tree  
```

. ├── mediaconvert.sh ├── mediaconvert.tf ├── mediaconvert\_url.sh ├── mediaconvert\_url.tf ├── presets │ ├── aws-mediaconvert-preset-a-1.json │ └── aws-mediaconvert-preset-p-1.json ├── provider.tf ├── templates └── aws-mediaconvert-template.json

 Copy

 

```
Time to test 😹 Now lets test with  
```

## terraform init   # for initialization terraform terraform plan   # planning what to create and/or destroy terraform apply -auto-approve     # create all terraform destroy -auto-approve   # To destroy all

 Copy

 

After terraform apply we can see our output presets and job template in the AWS console

![2](https://www.craftsmensoftware.com/hs-fs/hubfs/2.png?width=700&height=108&name=2.png)

Finally, you can run a MediaConvert job with the template to test it. Before that don’t forget to create an IAM role for MediaConvert with necessary S3 bucket permission. 

 

![Mahabubur Rahaman Melon](https://www.craftsmensoftware.com/hs-fs/hubfs/Mahabubur%20Rahaman%20Melon.png?width=120&height=120&name=Mahabubur%20Rahaman%20Melon.png)

Author: **[Mahabubur Rahaman Melon](https://www.craftsmensoftware.com/blog/author/mahabubur-rahaman-melon)**  
 23/04/2024

 Software Development Engineer

![Hire AI-Native Engineers](https://www.craftsmensoftware.com/hubfs/Z63_3132.webp)

## Hire AI-Native Engineers

[![Book A Strategy Call](https://www.craftsmensoftware.com/hubfs/Book%20A%20Strategy%20Call.svg)](https://www.craftsmensoftware.com/contact-us)

### **About Craftsmen**

[The Team](https://www.craftsmensoftware.com/about-us)

[Our Partnership Model](https://www.craftsmensoftware.com/how-we-work)  
[Career](https://careers.craftsmensoftware.com/)

[FAQ](https://www.craftsmensoftware.com/frequently-asked-questions-faq)  
[Privacy Policy](https://www.craftsmensoftware.com/privacy-policy-best-software-development-company-in-bangladesh) 

[Craftsmen LinkedIn Page](https://linkedin.com/company/craftsmensoftware)   [Craftsmen Facebook Page](https://www.facebook.com/craftsmenltd/)   [Craftsmen Youtube Page](https://www.youtube.com/@craftsmensoftware)

### **Headquarter**

**Craftsmen UK**  
One Sovereign Quay, Bridge End, Leeds, West Yorkshire LS1 4AG United Kingdom 

**Operational Hub

Craftsmen Bangladesh**  
Plot # 316, Lane # 4, DOHS Baridhara,

Dhaka - 1206, Bangladesh

### **Sales & Partnership Offices**

**Craftsmen Norway**  
Kong Oscars gate 66, 68, 5017 Bergen, Norway

**Craftsmen France**  
6 Avenue Pierre Grenier, 92100 Boulogne-Billancourt, Paris, France

### **A Team You Can Trust**

#### [![ISO Certificates New](https://www.craftsmensoftware.com/hs-fs/hubfs/ISO%20Certificates%20New.png?width=300&height=96&name=ISO%20Certificates%20New.png)](https://www.craftsmensoftware.com/trust-centre)

[![glassdoor (1)](https://www.craftsmensoftware.com/hs-fs/hubfs/glassdoor%20(1).png?width=110&height=79&name=glassdoor%20(1).png)](https://www.glassdoor.com/Overview/Working-at-Craftsmen-EI_IE3004266.11,20.htm) [![goodfirms.co](https://www.craftsmensoftware.com/hs-fs/hubfs/goodfirms.co.webp?width=110&height=95&name=goodfirms.co.webp)](https://www.craftsmensoftware.com/blog/craftsmen-thrives-at-goodfirms-by-offering-scalable-robust-software-solutions-developed-with-quality-by-maestros)

 

 © 2026 Craftsmen. All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Mahabubur Rahaman Melon",
    "url" : "https://www.craftsmensoftware.com/blog/author/mahabubur-rahaman-melon"
  },
  "dateModified" : "2026-04-30T11:20:57.120Z",
  "datePublished" : "2024-04-22T19:00:00.000Z",
  "headline" : "Terraform support for job templates and output presets of AWS Elemental MediaConvert",
  "image" : [ "https://www.craftsmensoftware.com/hubfs/AWS_Lambda_Intregation-2.webp" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.craftsmensoftware.com/blog/terraform-support-for-job-templates-and-output-presets-of-aws-elemental-mediaconvert",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.craftsmensoftware.com/hubfs/Craftsmen%20Logo_Black.png"
    },
    "name" : "Craftsmen Ltd."
  }
}
```

```json
{
  "@context" : "https://schema.org",
  "@type" : "SoftwareCompany",
  "address" : [ {
    "@type" : "PostalAddress",
    "addressCountry" : "Norway",
    "addressLocality" : "Oslo"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United Kingdom",
    "addressLocality" : "London"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "France",
    "addressLocality" : "Paris"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "New York"
  }, {
    "@type" : "PostalAddress",
    "addressCountry" : "Bangladesh",
    "addressLocality" : "Dhaka"
  } ],
  "areaServed" : [ {
    "@type" : "Country",
    "name" : "Norway"
  }, {
    "@type" : "Country",
    "name" : "Sweden"
  }, {
    "@type" : "Country",
    "name" : "United Kingdom"
  }, {
    "@type" : "Country",
    "name" : "France"
  }, {
    "@type" : "Country",
    "name" : "United States"
  }, {
    "@type" : "Country",
    "name" : "Bangladesh"
  } ],
  "description" : "Trusted AI-native engineering partner providing software team extension, IT staff augmentation, and dedicated developer teams globally.",
  "logo" : "https://www.craftsmensoftware.com/hubfs/logo.png",
  "name" : "Craftsmen Software",
  "url" : "https://www.craftsmensoftware.com"
}
```