Quick overview: Use the CloudFormation Registry to publish, version, and activate custom resource providers (resource types). Providers package a JSON schema and handler code (create/update/delete) so CloudFormation can perform lifecycle operations for non‑native resources.
What the Registry provides
- A central place to publish and register resource types (extensions) so CloudFormation can use them.
- Support for:
- Private extensions (owned and maintained within your account/organization).
- Public third‑party extensions available in the CloudFormation Registry.
- A mechanism to define a resource’s schema (JSON Schema) and handlers (the code executed on create/update/delete).
- Versioning, activation, and lifecycle management for type versions.
| Resource Type | Use Case | Example |
|---|---|---|
| Private Type | Internal automation, custom resources for your org | MyCompany::MyService::MyResource |
| Public Third‑party Type | Vendor-provided integrations that extend CloudFormation | VendorX::Service::Resource |
| AWS Type | Native AWS resources maintained by AWS | AWS::S3::Bucket |
Type namespaces and naming
- AWS types: begin with
AWS::(built-in). - Third‑party/public types: typically use the vendor namespace, e.g.,
Vendor::Service::Resource. - Private types: use your company or account scope, e.g.,
MyCompany::Service::Resource.
Typical provider workflow
- Author a resource provider:
- Define the resource schema (JSON Schema) describing properties, required fields, and return values.
- Implement handlers that perform create, read, update, delete, and list (CRUDL) operations.
- Use the cloudformation-cli to scaffold, build, and test handlers in supported languages (Python, Java, Go).
- Package the provider into a Schema Handler Package (SHP) and upload to a supported location (for example, Amazon S3).
- Register the type with CloudFormation (register-type).
- Activate the type version you want to use.
- Reference the registered type inside CloudFormation templates.
- Manage new versions: register, test, and activate updates when ready.
Common CLI commands
Table: Core CloudFormation Registry commands| Action | AWS CLI command | Notes |
|---|---|---|
| Register type | aws cloudformation register-type | Provide --schema-handler-package pointing to SHP |
| Check registration status | aws cloudformation describe-type-registration | Use the registration token |
| List types | aws cloudformation list-types | Filter by --visibility PRIVATE or PUBLIC |
| Describe a type | aws cloudformation describe-type | Use --type-name to get details and TypeVersionArn |
| Deregister type | aws cloudformation deregister-type | Removes a type registration |
Using custom types in templates
After you’ve registered and activated a type, reference it in your CloudFormation templates using its Type name and supply the properties defined by the provider schema. Example (YAML):Development tools
- cloudformation-cli: Official tool to initialize, build, test, and submit resource providers in supported languages.
- Local testing: cloudformation-cli includes contract testing and local invocation helpers to validate handler behavior against the provider schema.
- Packaging: Build an SHP (Schema Handler Package) containing schema and handler artifacts; host it in a secure location such as an S3 bucket.
Versioning and activation
- Types support multiple versions. Register new versions when you update schema or handler code.
- Activation is explicit: you can register versions without immediately activating them for production stacks.
- Inspect versions and activation state with
describe-typeandlist-type-registrations. - Follow semantic versioning and document breaking changes. Activate new versions in a controlled fashion (CI/CD pipeline) to reduce disruption.
Security and IAM
Registering types and executing handler code requires IAM permissions. Handler code might run in your account (for private types) and will need the appropriate execution environment permissions. Always review handler behavior and grant least privilege.
- Review public third‑party extension source and required permissions before use.
- Store SHPs in private, access‑controlled S3 buckets with encryption and restricted IAM roles.
- Use separate IAM execution roles for provider handlers and scope permissions using least privilege.
- Audit CloudFormation stack events and provider logs to detect unexpected behavior.
Best practices
- Test providers thoroughly using the cloudformation-cli local and contract tests prior to registration.
- Document the provider schema and examples for consumers.
- Use semantic versioning and keep release notes for each registered type version.
- Prefer private types for internal automations; adopt public types only after security and functional review.
- Automate registration and activation via CI/CD pipelines with gating and automated tests.
Links and references
- CloudFormation Registry overview — AWS Docs
- CloudFormation CLI (cloudformation-cli)
- CloudFormation template anatomy
- IAM documentation
- Amazon S3