{"id":32187507,"url":"https://github.com/portkey-cloud/cfn-yaml","last_synced_at":"2026-02-21T17:35:30.013Z","repository":{"id":54221759,"uuid":"163583353","full_name":"portkey-cloud/cfn-yaml","owner":"portkey-cloud","description":"Generate and parse Cloudformation Yaml","archived":false,"fork":false,"pushed_at":"2021-03-02T19:31:58.000Z","size":35,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-22T04:06:59.423Z","etag":null,"topics":["clojure","cloudformation"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/portkey-cloud.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":"2018-12-30T11:48:28.000Z","updated_at":"2021-03-02T19:32:01.000Z","dependencies_parsed_at":"2022-08-13T09:30:52.848Z","dependency_job_id":null,"html_url":"https://github.com/portkey-cloud/cfn-yaml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/portkey-cloud/cfn-yaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portkey-cloud%2Fcfn-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portkey-cloud%2Fcfn-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portkey-cloud%2Fcfn-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portkey-cloud%2Fcfn-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/portkey-cloud","download_url":"https://codeload.github.com/portkey-cloud/cfn-yaml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portkey-cloud%2Fcfn-yaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29688299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T15:51:39.154Z","status":"ssl_error","status_checked_at":"2026-02-21T15:49:03.425Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clojure","cloudformation"],"created_at":"2025-10-22T00:04:29.860Z","updated_at":"2026-02-21T17:35:25.005Z","avatar_url":"https://github.com/portkey-cloud.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cfn-yaml \n\n[![CircleCI](https://circleci.com/gh/portkey-cloud/cfn-yaml.svg?style=svg)](https://circleci.com/gh/portkey-cloud/cfn-yaml)\n[![Clojars Project](https://img.shields.io/clojars/v/portkey-cloud/cfn-yaml.svg)](https://clojars.org/portkey-cloud/cfn-yaml)\n\nGenerate (and read) Cloudformation Yaml templates from Clojure data.\n\nAlso validates references in the templates.\n\n## Status and motivation\n\nInitial goal was to be able to parse ClouFormation Yaml templates that contain [intrinsic function](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) tags, for example `!Sub 'Hello ${AWS::StackName}'`, into Clojure data. These [tags](https://yaml.org/spec/1.1/#local%20tag/) need support from the parser, for which [snakeyaml](https://bitbucket.org/asomov/snakeyaml/wiki/Documentation#markdown-header-constructors-representers-resolvers) provides support via constructors and representers. This library implements constructors and representers for some short form tags: Sub, Ref, Cidr, Base64, GetAtt, Join, FindInMap.\n\n## Usage\n\nFirst, add the dependency to `deps.edn`:\n\n```clojure\n{:deps {portkey-cloud/cfn-yaml {:git/url \"https://github.com/portkey-cloud/cfn-yaml\"\n                                :sha \"79b3c975a25c14f12c41398863f1cb4a3521c4e7\"}}}\n```\n\nThen hack in the repl :). The example below uses [aws-api](https://github.com/cognitect-labs/aws-api) for pushing the generated YAML to Cloudformation API, so the repl is started with a `AWS_PROFILE` containing credentials for making API calls to AWS.\n\n```clojure\n0% AWS_REGION=eu-west-1 AWS_PROFILE=tiuhti clj -A:aws:rebel\n[Rebel readline] Type :repl/help for online help info\nuser=\u003e (require '[cfn-yaml.core :as cfn])\nnil\nuser=\u003e (require '[cfn-yaml.tags.api :refer :all]) ;; For convenience, i.e. (!Sub \"...\")\nnil\nuser=\u003e (def tpl (cfn/generate-string\n  #_=\u003e  {:Parameters {:NamePrefix {:Type \"String\"}}\n  #_=\u003e   :Resources (into {} (for [stage [:dev :test :prod]\n  #_=\u003e                             :let [stage-name (name stage)]]\n  #_=\u003e                         [stage-name {:Type \"AWS::S3::Bucket\"\n  #_=\u003e                                      :Properties {:BucketName (!Sub (str \"${NamePrefix}-\" stage-name))}}]))}))\n#'user/tpl\nuser=\u003e (println tpl)\nParameters:\n  NamePrefix:\n    Type: String\nResources:\n  dev:\n    Type: AWS::S3::Bucket\n    Properties:\n      BucketName: !Sub '${NamePrefix}-dev'\n  test:\n    Type: AWS::S3::Bucket\n    Properties:\n      BucketName: !Sub '${NamePrefix}-test'\n  prod:\n    Type: AWS::S3::Bucket\n    Properties:\n      BucketName: !Sub '${NamePrefix}-prod'\nnil\nuser=\u003e (cfn/parse tpl)\n#ordered/map ([:Parameters #ordered/map ([:NamePrefix #ordered/map ([:Type \"String\"])])]\n              [:Resources #ordered/map ([:dev #ordered/map ([:Type \"AWS::S3::Bucket\"]\n                                                            [:Properties #ordered/map ([:BucketName #cfn_yaml.tags.!Sub{:string \"${NamePrefix}-dev\", :bindings{}}])])]\n                                        [:test #ordered/map ([:Type \"AWS::S3::Bucket\"]\n                                                             [:Properties #ordered/map ([:BucketName #cfn_yaml.tags.!Sub{:string \"${NamePrefix}-test\", :bindings {}}])])]\n                                        [:prod #ordered/map ([:Type \"AWS::S3::Bucket\"]\n                                                             [:Properties #ordered/map ([:BucketName #cfn_yaml.tags.!Sub{:string \"${NamePrefix}-prod\", :bindings {}}])])])])\nuser=\u003e (require '[cognitect.aws.client.api :as aws])\nnil\nuser=\u003e (def cfn-client (aws/client {:api :cloudformation}))\n#'user/cfn-client\nuser=\u003e (aws/invoke cfn-client {:op :CreateStack\n  #_=\u003e                         :request {:StackName \"cfn-yaml-demo\"\n  #_=\u003e                                   :TemplateBody tpl\n  #_=\u003e                                   :Parameters [{:ParameterKey \"NamePrefix\"\n  #_=\u003e                                                 :ParameterValue (str (java.util.UUID/randomUUID))}]}})\n{:StackId \"arn:aws:cloudformation:eu-west-1:262355063596:stack/cfn-yaml-demo/290de310-0c25-11e9-9e69-0a611b368f3e\"}\nuser=\u003e (def s (aws/invoke cfn-client {:op :DescribeStackResources\n  #_=\u003e                                :request {:StackName \"cfn-yaml-demo\"}}))\n#'user/s\nuser=\u003e (doseq [{:keys [LogicalResourceId PhysicalResourceId]} (:StackResources s)]\n  #_=\u003e   (println LogicalResourceId PhysicalResourceId))\ndev 2b5a9713-292c-488a-b4e0-32196a34471b-dev\nprod 2b5a9713-292c-488a-b4e0-32196a34471b-prod\ntest 2b5a9713-292c-488a-b4e0-32196a34471b-test\n```\n\n## License\n\nCopyright © 2018-2020 Kimmo Koskinen\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportkey-cloud%2Fcfn-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportkey-cloud%2Fcfn-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportkey-cloud%2Fcfn-yaml/lists"}