{"id":13563220,"url":"https://github.com/aws-cloudformation/cloudformation-cli","last_synced_at":"2025-05-15T00:09:55.691Z","repository":{"id":36228723,"uuid":"143929054","full_name":"aws-cloudformation/cloudformation-cli","owner":"aws-cloudformation","description":"The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.","archived":false,"fork":false,"pushed_at":"2025-04-01T00:15:54.000Z","size":1689,"stargazers_count":331,"open_issues_count":150,"forks_count":165,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-05-01T11:23:27.906Z","etag":null,"topics":["aws","aws-cloudformation","cloudformation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aws-cloudformation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-07T21:33:19.000Z","updated_at":"2025-04-14T17:49:59.000Z","dependencies_parsed_at":"2023-07-19T00:12:44.489Z","dependency_job_id":"5c808dad-e7f8-46ec-ac40-393d0ade8425","html_url":"https://github.com/aws-cloudformation/cloudformation-cli","commit_stats":{"total_commits":553,"total_committers":70,"mean_commits":7.9,"dds":0.7613019891500904,"last_synced_commit":"71a65e08e3f6cd2ef0b13e31e1386f0235669866"},"previous_names":["aws-cloudformation/aws-cloudformation-rpdk"],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aws-cloudformation%2Fcloudformation-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aws-cloudformation","download_url":"https://codeload.github.com/aws-cloudformation/cloudformation-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254247189,"owners_count":22038772,"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","aws-cloudformation","cloudformation"],"created_at":"2024-08-01T13:01:16.559Z","updated_at":"2025-05-15T00:09:50.678Z","avatar_url":"https://github.com/aws-cloudformation.png","language":"Python","funding_links":[],"categories":["aws","Custom Resource Development","Python"],"sub_categories":["Hooks"],"readme":"[![CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli/actions/workflows/pr-ci.yaml/badge.svg?branch=master)](https://github.com/aws-cloudformation/cloudformation-cli/actions/workflows/pr-ci.yaml)\n\n# AWS CloudFormation CLI\n\nThe CloudFormation CLI (cfn) allows you to author your own resource providers, hooks, and modules that can be used by CloudFormation.\n\n## Usage\n\n### Documentation\n\nPrimary documentation for the CloudFormation CLI can be found at the [AWS Documentation](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/what-is-cloudformation-cli.html) site.\n\n### Installation\n\nThis tool can be installed using [pip](https://pypi.org/project/pip/) from the Python Package Index (PyPI). It requires Python 3. For resource and hook types, the tool requires at least one language plugin. Language plugins are not needed to create a module type. The language plugins are also available on PyPI and as such can be installed all at once:\n\n```bash\npip install cloudformation-cli cloudformation-cli-java-plugin cloudformation-cli-go-plugin cloudformation-cli-python-plugin cloudformation-cli-typescript-plugin\n```\n\n\n### Command: init\n\nTo create a project in the current directory, use the `init` command. A wizard will guide you through the creation.\n\n```bash\ncfn init\n```\n\n### Command: generate\n\nTo refresh auto-generated code, use the `generate` command. Usually, plugins try to integrate this command in the native build flow, so please consult a plugin's README to see if this is necessary.\nIn a module project, this will regenerate the module schema.\n\n```bash\ncfn generate\n```\n\n### Command: submit\n\nTo register a resource provider, module, or hook in your account, use the `submit` command.\n\n```bash\ncfn submit\ncfn submit --dry-run #prepares schema handler package without submitting for registration\ncfn submit --set-default # if successfully registered, set submitted version to be the new default version\n```\n\n### Command: package\n\nThis is to create a schema handler package without submitting equivalent to `cfn submit --dry-run`\n\n```bash\ncfn package\n```\n\n### Command: test\n\nTo run the contract tests for a resource type, use the `test` command.\n\n```bash\ncfn test\ncfn test -- -k contract_delete_update # to run a single test\ncfn test -- --tb=long # exhaustive, informative traceback formatting\ncfn test --enforce-timeout 60  # Read/List handler timeout (Create/Update/Delete handler timeout is twice the Read/List handler timeout)\ncfn test --enforce-timeout 60 -- -k contract_delete_update # combine arguments\ncfn test --log-group-name cw_log_group --log-role-arn log_delivery_role_arn # Handler logs generated by contract tests will be delivered to the specified cw_log_group using the credentials from log_delivery_role_arn\n```\n\nNote:\n* To use your type configuration in contract tests, you will need to save your type configuration json file in `~/.cfn-cli/typeConfiguration.json` or specify the file you would like to use\n    * `--typeconfig ./myResourceTypeConfig.json`\n    * `--typeconfig /test/myresource/config1.json`\n    * `--typeconfig C:\\MyResource\\typeconf.json`\n\n* To use `propertyTransform` in schema, you will need to install [PYJQ](https://pypi.org/project/pyjq/). This feature will not be available to use with contract tests on Windows OS\n\nInstall PYJQ for Linux system\n\n```bash\nyum install autoconf automake libtool\npip install pyjq\n```\n\nInstall PYJQ for macOS system\n\n```bash\nbrew install autoconf automake libtool\nbrew install jq\npip install pyjq\n```\n\nInstall PYJQ for Ubuntu system\n\n```bash\npip install pyjq\n```\n\n### Command: validate\n\nTo validate the schema, use the `validate` command.\n\nThis command is automatically run whenever one attempts to submit a resource, module, or hook. Errors will prevent you from submitting your resource/module. Module fragments will additionally be validated via [`cfn-lint`](https://github.com/aws-cloudformation/cfn-python-lint/) (but resulting warnings will not cause this step to fail).\n\n```bash\ncfn validate\n```\n\n### Command: build-image\n\nTo build an image for a resource type. This image provides a minimalistic execution environment for the resource handler that does not depend on AWS Lambda in anyway. This image can be used during cfn invoke and cfn test instead of using sam cli.\n\n```bash\ncfn build-image\ncfn build-image --image-name my-handler --executable target/myjar.jar\n```\n\nThe resulting image can be run in a container by executing the following command:\n\n```\ndocker run IMAGE_NAME HANDLER_ENTRYPOINT PAYLOAD\ndocker run my-test-resource com.my.test.resource.ExecutableHandlerWrapper PAYLOAD_JSON # Example for a java based-project\n```\n\n\n## Development\n\nFor developing, it's strongly suggested to install the development dependencies inside a virtual environment. (This isn't required if you just want to use this tool.)\n\n```bash\npython3 -m venv env\nsource env/bin/activate\npip install -e . -r requirements.txt\npre-commit install\n```\n\nIf you're creating a resource or hook type, you will also need to install a language plugin, such as [the Java language plugin](https://github.com/aws-cloudformation/cloudformation-cli-java-plugin), also via `pip install`. For example, assuming the plugin is checked out in the same parent directory as this repository:\n\n```bash\npip install -e ../cloudformation-cli-java-plugin\n```\n\n```bash\n# run all hooks on all files, mirrors what the CI runs\npre-commit run --all-files\n# run unit tests only. can also be used for other hooks, e.g. black, flake8, pylint-local\npre-commit run pytest-local\n```\n\nIf you want to generate an HTML coverage report afterwards, run `coverage html`. The report is output to `htmlcov/index.html`.\n\n## Plugin system\n\nNew language plugins can be independently developed. As long as they declare the appropriate entry point and are installed in the same environment, they can even be completely separate codebases. For example, a plugin for Groovy might have the following entry point:\n\n```python\nentry_points={\n    \"rpdk.v1.languages\": [\"groovy = rpdk.groovy:GroovyLanguagePlugin\"],\n},\n```\n\nPlugins must provide the same interface as `LanguagePlugin` (in `plugin_base.py`). And they may inherit from `LanguagePlugin` for the helper methods - but this is not necessary. As long as the class has the same methods, it will work as a plugin.\n\n### Supported plugins\n\n#### Resource Types Supported Plugins\n| Language | Status            | Github                                                                                                      | PyPI                                                                                       |\n| -------- | ----------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |\n| Java      | Available         | [cloudformation-cli-java-plugin](https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/)     | [cloudformation-cli-java-plugin](https://pypi.org/project/cloudformation-cli-java-plugin/)     |\n| Go        | Available         | [cloudformation-cli-go-plugin](https://github.com/aws-cloudformation/cloudformation-cli-go-plugin/)         | [cloudformation-cli-go-plugin](https://pypi.org/project/cloudformation-cli-go-plugin/)         |\n| Python    | Available         | [cloudformation-cli-python-plugin](https://github.com/aws-cloudformation/cloudformation-cli-python-plugin/) | [cloudformation-cli-python-plugin](https://pypi.org/project/cloudformation-cli-python-plugin/) |\n| TypeScript| Available         | [cloudformation-cli-typescript-plugin](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/) | [cloudformation-cli-typescript-plugin](https://pypi.org/project/cloudformation-cli-typescript-plugin/) |\n\n#### Hook Types Supported Plugins\n| Language | Status            | Github                                                                                                      | PyPI                                                                                       |\n| -------- | ----------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |\n| Java      | Available         | [cloudformation-cli-java-plugin](https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/)     | [cloudformation-cli-java-plugin](https://pypi.org/project/cloudformation-cli-java-plugin/)     |\n| Python    | Available         | [cloudformation-cli-python-plugin](https://github.com/aws-cloudformation/cloudformation-cli-python-plugin/) | [cloudformation-cli-python-plugin](https://pypi.org/project/cloudformation-cli-python-plugin/) |\n\n## License\n\nThis library is licensed under the Apache 2.0 License.\n\n## Community\n\nJoin us on Discord! Connect \u0026 interact with CloudFormation developers \u0026\nexperts, find channels to discuss and get help for our CLI, cfn-lint, CloudFormation registry, StackSets,\nGuard and more:\n\n[![Join our Discord](https://discordapp.com/api/guilds/981586120448020580/widget.png?style=banner3)](https://discord.gg/9zpd7TTRwq)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-cloudformation%2Fcloudformation-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faws-cloudformation%2Fcloudformation-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faws-cloudformation%2Fcloudformation-cli/lists"}