8.1.0 • Published 1 month ago

@mapbox/cloudfriend v8.1.0

Weekly downloads
31,635
License
ISC
Repository
github
Last release
1 month ago

cloudfriend

Build Status

Helper functions for assembling CloudFormation templates in JavaScript.

Shortcuts

Cloudfriend contains a library of JS classes that reduce the amount of "boilerplate" CloudFormation that you need to write to setup a common set of AWS Resources. See the shortcuts readme for more information, or the shortcuts API documentation to look at shortcut-specific configuration.

Intrinsic functions and conditions

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

CloudFriendCloudFormation
base64(value)Fn::Base64
cidr(ipBlock, count, cidrBits)Fn::Cidr
findInMap(mapping, key, attr)Fn::FindInMap
forEach(uniqueLoopName, identifier, collection, outputKeyPrefix, outputValue)Fn::ForEach
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
transform(name, parameters)Fn::Transform
contains(strings, s)Fn::Contains
eachMemberEquals(strings, s)Fn::EachMemberEquals
eachMemberIn(stringsToCheck, stringsToMatch)Fn::EachMemberIn
refAll(parameterType)Fn::RefAll
valueOf(parameterLogicalId, attribute)Fn::ValueOf
valueOfAll(parameterType, attribute)Fn::ValueOfAll

Pseudo parameters

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

CloudFriendCloudFormation
accountIdAWS::AccountId
notificationArnsAWS::NotificationARNs
noValueAWS::NoValue
regionAWS::Region
stackIdAWS::StackId
stackNameAWS::StackName
partitionAWS::Partition
urlSuffixAWS::URLSuffix

Other helpers

methoddescription
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. Transform macros from all template arguments are merged into a single array, in order of their appearance in the template arguments, and an error is thrown if any macro is repeated.

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
8.1.0

1 month ago

8.1.0-dev.2

1 month ago

8.1.0-dev

1 month ago

8.0.0-1

3 months ago

8.0.0-0

3 months ago

8.0.0

3 months ago

7.3.0-6

3 months ago

7.3.0-8

3 months ago

7.3.0-5

3 months ago

7.3.0-4

3 months ago

7.2.0-2

3 months ago

7.2.0-3

3 months ago

7.2.0-0

3 months ago

7.2.0-1

3 months ago

7.0.1-0

9 months ago

7.1.0

8 months ago

7.1.1-rc.0

5 months ago

7.0.1-1

9 months ago

7.0.1-2

9 months ago

7.0.1-3

9 months ago

7.0.0-0

9 months ago

7.0.0-1

9 months ago

7.0.0

9 months ago

7.0.1

9 months ago

7.0.0-2

9 months ago

6.0.0

2 years ago

6.0.0-SNAPSHOT-1

2 years ago

5.1.2-SNAPSHOT-9

2 years ago

5.1.2-SNAPSHOT-8

2 years ago

5.1.2-SNAPSHOT-5

2 years ago

5.1.2-SNAPSHOT-4

2 years ago

5.1.2-SNAPSHOT-7

2 years ago

5.1.2-SNAPSHOT-6

2 years ago

5.1.2-SNAPSHOT-1

2 years ago

5.1.2-SNAPSHOT-3

2 years ago

5.1.2-SNAPSHOT-2

2 years ago

5.1.1

2 years ago

5.1.0

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.6.0

3 years ago

4.5.1

3 years ago

4.5.0

3 years ago

4.4.0

4 years ago

4.3.0

4 years ago

4.2.3

4 years ago

4.2.2

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.3

4 years ago

4.1.2

4 years ago

4.1.0

4 years ago

4.1.1

4 years ago

4.0.0

4 years ago

3.8.1

5 years ago

3.8.0

5 years ago

3.7.0

5 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.0

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.8.2

5 years ago

2.8.1

5 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.10.0

6 years ago

1.9.1

6 years ago

1.9.0

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago