[object Object] Icon

Encoding
Learn how to create, start, manage and modify Encodings

[object Object] Icon

Player
Learn how to create, start, manage and modify Players

[object Object] Icon

Analytics
Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Wed Sep 16 2020

How to create an S3 Encoding Input or Output with the Bitmovin API

OverviewLink Icon

Your encoding workflow needs to have access to Input and Output storage to retrieve source files and write encoded files. When using AWS (Amazon Web Services), you will need to use S3 buckets as storage.

In the simplest configuration, you will provide the Bitmovin Encoding Service with an Access and Secret key pair, attached to an AWS IAM (Identity and Access Management) User with appropriate permissions to access those buckets.

This tutorial will walk you through the steps to create an S3 bucket, configure it to your needs, and then create Input and Output resources in the Bitmovin Encoding service.

Note: There is an alternative mechanism to grant access to your S3 buckets, with role-based access. If this is what you need, consult the S3 Role-Based Input and Output tutorial instead.

Create an AWS S3 BucketLink Icon

In the AWS Management Console, open the S3 section.

  1. Click on the Create Bucket button which starts the bucket creation wizard
  2. In the "Name and Region" panel, choose a bucket name (for example my-bitmovin-bucket) and a Region (for example (EU) Ireland)), then press Next
  3. The options in the "Configure options" view are all optional and do not affect how Bitmovin uses your bucket. Press Next
  4. The way you configure options under "Set permissions" depends on how you want to use the bucket. The default settings will block public access which is generally recommended, unless you want to test playback or easily provide access to files in your bucket directly. We provide an FAQ for details on how to configure it for public access.
  5. Finish going through the wizard and click Create Bucket

Your bucket is now ready to be used.

Create an AWS IAM UserLink Icon

Next we need to create a user that will be accessing the bucket. We continue working with the AWS Console

  1. Open the Identity and Access Management (IAM) console
  2. On the left pane, click on "Access Management" -> "Users".
  3. Click on Add User. The Add User page appears.
  4. In the first page, add your desired User name then select Programmatic access for access type.
  5. In the Permissions page, select AmazonS3FullAccess.

    (Note: The pre-defined AmazonS3FullAccess policy is known to be suitable but since it provides unrestricted access to your bucket, you might need to create a custom policy with fine-tuned access rights. Please review details of the permissions required for buckets for Encoding Input and Output buckets and create a specific IAM Policy and associate it with this user as needed )

  6. Go through the next screens - those settings are optional and do not affect the configuration.
  7. On the last screen, press Create User

After the user was successfully created, a page will display the two keys you need to store securely (Access Key ID and Secret Access Key). You need to store them somewhere securely as you will need them later. Note that once you've left this screen, you will not be able to retrieve the Secret Access Key anymore and will need to generate a new one.

If you want to learn more about Users in AWS, please see their documentation.


Create an S3 Input/OutputLink Icon

S3 input and output resources can be created via the Bitmovin API or in the Bitmovin Dashboard. The minimal required information to create an S3 input or output are the following :

  • bucketName: the name of your S3 bucket
  • accessKey and secretKey: the Access Key ID and Secret Access Key obtained earlier.

(Java) S3 Output ExampleLink Icon

This example uses our latest Open API client for Java, which is available on Github.

Create a new S3 Output

1bitmovinApi = BitmovinApi.builder().withApiKey("YOUR_BITMOVIN_API_KEY").build();
2
3AclEntry aclEntry = new AclEntry();
4aclEntry.setPermission(AclPermission.PRIVATE);
5
6List<AclEntry> acl = new ArrayList<>();
7acl.add(aclEntry);
8
9S3Output s3Output = new S3Output();
10s3Output.setBucketName("<BUCKET_NAME>");
11s3Output.setAccessKey("<AWS_ACCESS_KEY>");
12s3Output.setSecretKey("<AWS_SECRET_KEY>");
13s3Output.setAcl(acl);
14
15s3RoleBasedOutput = bitmovinApi.encoding.outputs.s3.create(s3Output);

Hint: In case you chose to enable Block public access on your S3 bucket (recommended), you would have to make sure that the ACL is set to PRIVATE on the output (as shown above) as well as on your Muxing configurations.

To create an Input is fairly similar, but you just use the S3Input resource and the bitmovinApi.encoding.inputs.s3 endpoint

Use an existing S3 Output

1bitmovinApi = BitmovinApi.builder().withApiKey("YOUR_BITMOVIN_API_KEY").build();
2
3S3Output s3Output = bitmovinApi.encoding.outputs.s3.get("YOUR_S3_OUTPUT_ID");

(CURL) S3 Output ExampleLink Icon

Create a new S3 Output

API reference: create an S3 Output:

1curl -X POST \
2 https://api.bitmovin.com/v1/encoding/outputs/s3 \
3 -H 'Content-Type: application/json' \
4 -H 'x-api-key: YOUR_BITMOVIN_API_KEY' \
5 -d '{
6 "bucketName": "<BUCKET_NAME>",
7 "accessKey": "<AWS_ACCESS_KEY>",
8 "secretKey": "<AWS_SECRET_KEY>",
9 "acl": [
10 {
11 "permission": "PRIVATE"
12 }
13 ]
14}'

Get an existing S3 Output

API reference: get an S3 Output

1curl https://api.bitmovin.com/v1/encoding/outputs/s3/YOUR_OUTPUT_ID \
2 -H 'Content-Type: application/json' \
3 -H 'x-api-key: YOUR_BITMOVIN_API_KEY'

What's Next?Link Icon

Now that you have created S3 Role-Based Inputs and/or Outputs, you can use them in your encoding in much the same way as you would any other Input or Output.

Give us feedback