Hacker News new | ask | show | jobs
by Arelius 1907 days ago
Honestly, I really like CFN, but raw templates are a bit of a disaster... Most of the rest of my infrastructure is powershell, so I acutally write the templates inline in Powershell something like this:

    New-AWSTemplate -Resources @{
        $OAI = @{
            Type = "AWS::CloudFront::CloudFrontOriginAccessIdentity"
            Properties = @{
                CloudFrontOriginAccessIdentityConfig = @{
                    Comment = "Access to the bucket"
                }
            }
        }
        ....
    }
If I were doing something without that context I'd likely use Javascript, and just stitch together template structures

I've tried out CDK but honestly it seems very opaque and hard to understand, I want to give it another shot but it just doesn't seem to be a direct translation from CFN templates...

1 comments

Having written more CFN than I care to remember CDK is a breath of fresh air. It has a multi-level API that deals with the relationships between resources in a much cleaner way than plain CFN. However, at the lowest level you can still write basically CFN in code. But CDK has so much more. It includes multi-language support, unit testing, compile time checking for errors, etc.