{"id":17419656,"url":"https://github.com/bendrucker/cfn-nest","last_synced_at":"2025-06-13T00:06:33.719Z","repository":{"id":48367121,"uuid":"81501017","full_name":"bendrucker/cfn-nest","owner":"bendrucker","description":"Transform relative stack paths in a CloudFormation template into full S3 URLs","archived":false,"fork":false,"pushed_at":"2022-07-25T21:44:44.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T10:04:09.873Z","etag":null,"topics":["aws","cli","cloudformation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bendrucker.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-09T22:23:49.000Z","updated_at":"2022-07-25T21:44:28.000Z","dependencies_parsed_at":"2022-08-29T11:10:37.916Z","dependency_job_id":null,"html_url":"https://github.com/bendrucker/cfn-nest","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/bendrucker/cfn-nest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fcfn-nest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fcfn-nest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fcfn-nest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fcfn-nest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bendrucker","download_url":"https://codeload.github.com/bendrucker/cfn-nest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fcfn-nest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259553130,"owners_count":22875609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cli","cloudformation"],"created_at":"2024-10-17T02:28:44.213Z","updated_at":"2025-06-13T00:06:33.692Z","avatar_url":"https://github.com/bendrucker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cfn-nest [![Build Status](https://travis-ci.org/bendrucker/cfn-nest.svg?branch=master)](https://travis-ci.org/bendrucker/cfn-nest) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/cfn-nest.svg)](https://greenkeeper.io/)\n\n\u003e Transform relative stack paths in a CloudFormation template into full S3 URLs\n\n\n## Install\n\n```\n$ npm install --save cfn-nest\n```\n\n\n## Usage\n\nGiven a pseudo-valid nested stack template:\n\n```json\n{\n  \"Resources\": {\n    \"Nested\": {\n      \"Type\": \"AWS::CloudFormation::Stack\",\n      \"Properties\": {\n        \"Template\": \"nested.json\"\n      }\n    }\n  }\n}\n```\n\n### CLI\n\n```sh\ncfn-nest template.json --bucket my-templates\n```\n\nAny nested templates will be uploaded to S3 as [required by CloudFormation](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-templateurl). The `Template` property will be replaced by a valid `TemplateURL`. This URL contains an MD5 hash of the file contents so different versions will always produce unique URLs. Un-nesting is performed *recursively* so you can write templates that reference templates that reference other templates (and so on).\n\nThe `Template` path is resolved *relative to the template source file*.\n\n### API\n\n```js\nvar CfnNest = require('cfn-nest')\nvar JSONStream = require('JSONStream')\nvar through = require('through2')\n\nfs.createReadStream('template.json')\n  .pipe(JSONStream.parse())\n  .pipe(CfnNest({bucket: 'my-templates'}))\n  .pipe(through.obj(function (chunk, enc, callback) {\n    callback(null, JSON.stringify(chunk))  \n  }))\n  .pipe(process.stdout)\n```\n\n## API\n\n#### `CfnNest(options)` -\u003e `stream`\n\nCreates a new `Transform` stream that expects parsed CloudFormation template objects as input.\n\n##### options\n\n###### bucket\n\n*Required*  \nType: `string`\n\nThe name of the S3 bucket to use.\n\n###### cwd\n\nType: `string`  \nDefault: `process.cwd()`\n\nThe working directory to use when resolving template paths. \n\n#### `stream.on('upload', handler)`\n\n##### handler\n\n*Required*  \nType: `function`  \nArguments: `file`\n\nA listener that will be called after each file upload. The `file` is an object with `local` and `s3` path properties.\n\n\n\n## License\n\nMIT © [Ben Drucker](http://bendrucker.me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fcfn-nest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbendrucker%2Fcfn-nest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fcfn-nest/lists"}