MediaPackage and MediaPAckagev2 channel in CloudFormation problem

0

Hi Guys, I tried to use CloudFormation to establish automatically all media services. However, when I tried to get output from MediaPackage channel resource or MediaPackagev2 channel I could not get it. The objects I used were: "AWS::MediaPackage::Channel" and "AWS::MediaPackageV2::Channel". According to CloudFormation at least version 2 should provide outputs for Ingest urls: **IngestEndpoints **(see details https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-mediapackagev2-channel.html). I got response like: "Template format error: Every Value member must be a string." Tried various tricks in CloudFormation but seem like non of them was work. These HLS ingest endpoints along with user and password are needed by MediaLive configuration. Do you know any workaround? Thanks

TomekO
已提问 1 个月前436 查看次数
2 回答
0

When you want to output something like IngestEndpoints, which is a list of objects, you need to specifically reference the attributes of the object you want to output and ensure they are converted to a string format. Unfortunately, CloudFormation does not natively support complex structures (like lists or maps) as outputs directly. You can only output strings.

However, you can work around this limitation by using a combination of intrinsic functions such as !Join, !Select, and !GetAtt to construct a string from the parts of the IngestEndpoints you need. For example, if you want to extract the URL of the first ingest endpoint, you could do something like this in your CloudFormation template:

Outputs:
  FirstIngestEndpointUrl:
    Description: URL of the first ingest endpoint
    Value: !Join
      - ''
      - - 'URL: '
        - !GetAtt
          - MyMediaPackageV2Channel
          - IngestEndpoints.0.Url
profile picture
专家
已回答 1 个月前
profile picture
专家
已审核 1 个月前
  • Hi Mina, Thank you for the prompt answer. I tried it but get: "Requested attribute IngestEndpoints.0.Url does not exist in schema for AWS::MediaPackageV2::Channel". When I use awscli it returns two endpoints. Ah...this is CloudFormation weirdness. It cannot deal with arrays :(.

0

If you are creating a live streaming channel with AWS Elemental MediaLive, AWS Elemental MediaPackage and CloudFront, you may want to investigate the Workflow Wizard feature with MediaLive. This will create all the components needed in a live channel. https://docs.aws.amazon.com/medialive/latest/ug/wizard.html

It will also create a CloudFormation template for additional channels. This may be useful as a reference to how MediaPackage is detailed in the template. Including a CloudFront distribution, when stepping through Workflow Wizard, will automatically connect MediaPackage Endpoints to CloudFront. The Endpoints will list the CloudFront URL associated with that output.

AWS
Mike-ME
已回答 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则