npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloudformation-preprocessor

v9.3.0

Published

An AWS CloudFormation template pre-processor

Downloads

49

Readme

CloudFormation PreProcessor

An AWS CloudFormation template pre-processor

Features

  • Update to the current AMIs - for example, the 'latest' Windows 2012 AMI from Amazon. 'Latest' is determined by sorting their names alphabetically and selecting the last.
  • Include external files into UserData and CloudFormation-Init files and commands, parsing content for { "Ref", ...} and { "Fn::GetAttr" }.

Clone

git clone https://github.com/leeatkinson/CloudFormationPreProcessor.git

Install

npm install --global cloudformation-preprocessor

Preparation

  1. Create your CloudFormation template as normal, with any AMI mappings you want updating in the following format:
{
    ...
    "Mappings": {
        ...
        "<mapping-name>": {
            "us-west-1": { "id": "<ami-id>" },
            "ap-southeast-1": { "id": "<ami-id>" },
            ...
        },
    ...
}
  1. Create a folder whose path is the same as the template but has an extra '.d' extension, and create two subfolders - 'mappings' and 'resources'.
MyTemplate.cloudformation
MyTemplate.cloudformation.d/
    mappings/
    resources/
  1. (Currently, the pre-processor only supports AMI mappings.) Inside the mappings folder, create a JSON file with the same name as the mapping in the template and a '.json' extension. The JSON for an AMI mapping is:
{
    "type": "ami",
    "ami": {
        "owner": "<owner>",
        "name": "Windows_Server-2012-RTM-English-64Bit-Base*"
    }
}

If ami.owner is unspecified, 'amazon' is used.

  1. Create a folder under the 'resources' folder with the same name as the resource itself.

MyTemplate.cloudformation.d/resources/

  1. Create a UserData file in the above resource's directory and name it 'userdata'. If this file has a .ps1 or .cmd file extension, the content is wrapped with <powershell></powershell> or <script></script> tags as appropriate before including in the template.

MyTemplate.cloudformation.d/resources/MyInstance/userdata.ps1

  1. For CloudFormation-Init files and commands, these are placed heirachically within the resource's directory, such as:

MyTemplate.cloudformation.d/resources/MyResource/configs/MyConfig/files/key MyTemplate.cloudformation.d/resources/MyResource/configs/MyConfig/commands/key

where key is the file key in the CloudFormation template.

For specifying a drive letter for Windows instances use the $ character instead of the : character (e.g. C$ instead of C:).

MyTemplate.cloudformation.d/resources/MyResource/configs/MyConfig/files/C$/folder/file

For specifying hidden files (without hiding them on you development machine) prefix the name with '$.'.

MyTemplate.cloudformation.d/resources/MyResource/configs/MyConfig/files/folder/$.file

Within files and commands, you can use {{ref foo}} and {{att foo bar}} and these will be converted to the appropriate cloudformation template objects { "Ref": "foo" } and { "Fn:GetAtt": [ "foo", "bar" ] }.

Execution

You can execute the CloudFormation PreProcessor without any arguments, and it will pre-process all templates with .cloudformation file extension in the current working directory.

cfnpp

To specify a different file pattern specify them as a argument.

cfnpp *.json

By default, the region used to find all other regions is EU-WEST-1. If you want to change this, use the -r or --region argument

cfnpp -r us-east-1