skip to Main Content

Beginner in AWS, so forgive me if the question is repetitive or easily explained. I have a CloudFormation template to spin up a new AWS MediaLive channel. I’ve used sceptre to develop this template, so all the config variables (including the channel and input attachment names) are localized in one config file.

I have been asked to dynamically change the channel name depending on the names of the existing channel names in AWS MediaLive (ex: if ‘chnl1’ and ‘chnl2’ already exist, update the ChannelName variable in the config file to be ‘chnl3’ when spinning up a new channel). Is there any way to do this with CloudFormation? If not, how would I go about this? Should I trigger a Lambda when the channel is created that goes in and changes the name? Unsure what the simplest way to do this would be.

I’ve looked into the update-channel function on the SDK reference docs but that seems like you need to pass in the entire channel configuration as a parameter? Unsure if that’s the best way to do this but I will if I have to.

2

Answers


  1. Since you’re using sceptre, you might want to write a script to make the API calls and edit the config file as a pre-deployment step. Then your template will represent the desired end state when you deploy it. You want to avoid making changes to deployed infrastructure after deploying the template, since that will introduce "drift", which means your template and your infrastructure are out of sync.

    Login or Signup to reply.
  2. Consider using a lambda function to customize the template channel JSON before invoking CreateChannel. Alternatively you could retrieve channel config with ‘describe channel’, modify json and ‘updateChannel’

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search