Converting Cloudformation to Yaml for AWS Firehose

Does anyone know of a definitive guide for converting cloudformation to yaml? I can make quite a few things work but I’m completely stuck on how to setup Firehose and allow a lambda to write to it.

I think the resources section would look something like this:

resources:
Resources:
  FirehoseBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: my-firehose-bucket
  FirehoseDeliveryStream:
    Type: AWS::KinesisFirehose::DeliveryStream
    Properties:
      DeliveryStreamName: "FirehoseDeliveryStream"
      S3DestinationConfiguration:
        BucketARN:
          Fn::Join:
          - ''
          - - 'arn:aws:s3:::'
            - Ref: FirehoseBucket
        BufferingHints:
          IntervalInSeconds: 60
          SizeInMBs: 5
        CompressionFormat: GZIP
        Prefix: ${prefix}
        RoleARN: "arn:aws:iam::${account-number}:role/${project}-${env}-IamRoleLambda"

But I have no idea how to convert the Cloudformation for the IAM section, which is described here: http://docs.aws.amazon.com/firehose/latest/dev/controlling-access.html.

Any pointers, examples or guides on CF->Yaml conversion much appreciated!

CFN is just JSON - you can use any JSON to YAML tool/service to do the conversion.

I haven’t used Kinesis yet myself, but I think what you’re trying to do should be possible. You may just need to include a reference to the IAM Role that is automatically assigned to your Lambda Functions by Serverless: IamRoleLambda. You can see an example (creating a resource and allowing access to it from your functions) on my blog about using DynamoDb with Serverless.

As rowanu already mentioned you can use any JSON->yml converted. for the IAM Role I would use a Ref instead of defining it directly (thats probably what rowanu meant as well)

With the new variable system, we’re merging soon you can even leave it in JSON and include it through the variable file syntax.

Also don’t forget to use serverless deploy --noDeploy to get the compiled CF template so you can take a look before deploying it. And if you get it running let me know, super interested in things like this and showing our community the different ways users set up complex projects on Serverless

Thanks Rowan I hadn’t thought to create individual policies as you have in your post, I think that will help. I’ll update with Progress.

Also thanks flomotlik, ‘deploy --noDeploy’ is really helping. I’m piecing together a lambda->firehose->redshift chain and will post here if I get it working. Cheers!

1 Like