How to set a custom domain name for AWS MediaLive RTMP_PUSH input destinations?

Viewed 242

An input with RTMP_PUSH type comes with two destinations, each with pre-assigned IP and port. But for the usability sake, I need to provide a URL with my domain name, not an IPv4 address of MediaLive input endpoint. Another important thing is that I'm creating inputs programmatically and need to make them available as soon as possible. Does AWS MediaLive provide a way to achieve it?

My very first thought was to create some endpoint on the web server that takes all necessary parameters and returns a 302 redirect to the appropriate endpoint for RTMP requests, but I'm still not sure if it's possible and if it's the good way to solve the problem.

Now the creation of a channel looks like the following:

import boto3

ML_REGION = 'eu-central-1'
client = boto3.client('medialive', region_name=ML_REGION)

def create_input(cls, name, destinations_names, sec_groups, in_type='RTMP_PUSH'):
    return client.create_input(
        Destinations=destinations_names,
        InputSecurityGroups=[
            sec_groups,
        ],
        Name=name,
        Type=in_type
    )

Which returns:

{
    "ResponseMetadata": {
        "HTTPHeaders": {...},
        "RequestId": "26b556d2-df7b-11e8-b224-a3bcca6f3675",
        "HTTPStatusCode": 201,
        "RetryAttempts": 0
    },
    "Input": {
        "State": "DETACHED",
        "SecurityGroups": [
            "3833595"
        ],
        "Id": "6345906",
        "Sources": [],
        "Type": "RTMP_PUSH",
        "Arn": "arn:aws:medialive:eu-central-1:928636723143:input:6250974",
        "AttachedChannels": [],
        "Name": "prog",
        "Destinations": [
            {
                "Ip": "52.29.243.126",
                "Url": "rtmp://52.29.243.126:1935/a",
                "Port": "1935"
            },
            {
                "Ip": "18.184.153.122",
                "Url": "rtmp://18.184.153.122:1935/b",
                "Port": "1935"
            }
        ]
    }
}

With this response I'm able to store, say, {stream_name: url} pairs and detect appropriate redirect URL for requests to my custom endpoint, but it doesn't look like a good solution. Moreover, not even sure if it's possible with RTMP.

0 Answers
Related