@mapbox/cloudfriend
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

@mapbox/cloudfriend

Helper functions for assembling CloudFormation templates in JavaScript

3.3.0  •  Updated 7 months ago  •  by mapbox  •  ISC License

cloudfriend

Build Status

Helper functions for assembling CloudFormation templates in JavaScript

Intrinsic functions and conditions

These are functions that you can use in place of various CloudFormation objects.

CloudFriend CloudFormation
base64(value) Fn::Base64
findInMap(mapping, key, attr) Fn::FindInMap
getAtt(obj, key) Fn::GetAtt
getAzs(region) Fn::GetAZs
join(delimiter, pieces) Fn::Join
split(delimiter, string) Fn::Split
select(index, list) Fn::Select
ref(name) Ref
userData(list) Fn::Base64 and Fn::Join with \n delimiter
and(conditions) Fn::And
equals(a, b) Fn::Equals
if(condition, ifTrue, ifFalse) Fn::If
not(condition) Fn::Not
or(conditions) Fn::Or
notEquals(a, b) Fn::Not and Fn::Equals
sub(str, variables) Fn::Sub
importValue(sharedValue) Fn::ImportValue,
arn(service, suffix) Fn::Sub designed for an ARN

Pseudo parameters

These are static properties of cloudfriend that you can use to reference various CloudFormation objects.

CloudFriend CloudFormation
accountId AWS::AccountId
notificationArns AWS::NotificationARNs
noValue AWS::NoValue
region AWS::Region
stackId AWS::StackId
stackName AWS::StackName
partition AWS::Partition
urlSuffix AWS::URLSuffix

Shortcuts

Cloudfriend contains a library of JS classes that reduce the amount of “boilerplate” CloudFormation that you need to write in order to setup a common set of AWS Resources. See the shortcuts readme for more information.

Other helpers

method description
build(file, opts) Builds a template defined by a static JavaScript export, a synchronous or an asynchronous function.
validate(file) Uses the cloudformation:ValidateTemplate API call to perform rudimentary template validation
merge(…template) Merges templates together. Throws errors if logical names are reused

CLI tools

By installing cloudfriend globally, it can provide you with simple CLI tools for building and validating CloudFormation templates.

# either...
$ git clone https://github.com/mapbox/cloudfriend && cd cloudfriend && npm link
# ... or ...
$ npm install -g @mapbox/cloudfriend

Then, to build a template:

# Prints the template as JSON to stdout
$ build-template path/to/template.js

Or, to validate a template:

# Make sure that your shell is configured to make AWS requests
$ validate-template path/to/template.js

You may also specify a region for validation:

# Make sure that your shell is configured to make AWS requests
$ validate-template path/to/template.js us-east-1

Popularity

Weekly Downloads
10.3K
Stars
50

Maintenance

Development

Last ver 7 months ago
Created 3 years ago
Last commit 4 months ago
8 days between commits

Technology

Node version: 12.6.0
308.1K unpacked

Compliance

ISC License
OSI Approved
0 vulnerabilities

Contributors

22 contributors
Ryan Clark
93 commits, 27 merges, 27 PRs
Works at Mapbox
David Clark
13 commits, 5 merges, 6 PRs
Works at mapbox
Franka
6 commits, 3 merges, 4 PRs
Works at mapbox
Nicki Peternel
6 commits, 2 merges, 2 PRs
emilymcafee
5 commits, 1 merges, 1 PRs
Young Hahn
5 commits, 1 merges
Works at Mapbox

Tags

AWS
CloudFormation
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.