| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Custom resources are special AWS CloudFormation resources that provide a way for a template developer to include resources in an AWS CloudFormation stack that are provided by a source other than Amazon Web Services. The custom resource provider can be either a template developer or a separate third-party resource provider.
In a template, a custom resource is represented by AWS::CloudFormation::CustomResource.
{
"Type" : "AWS::CloudFormation::CustomResource",
"Version" : "1.0",
"Properties" : {
"ServiceToken" : String,
... provider-defined properties ...
}
} Note
There is only one property that is defined by AWS for a custom resource: ServiceToken. All other properties are defined by the service provider.
For a custom resource, return values are defined by the custom resource provider, and are retrieved by calling Fn::GetAtt on the provider-defined attributes.
Here is an example of a custom resource definition in a template.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Resources" : {
"myUserResource" : {
"Type": "AWS::CloudFormation::CustomResource",
"Version" : "1.0",
"Properties" : {
"ServiceToken": "arn:aws:sns:us-east-1:84969EXAMPLE:CRTest",
"key1" : "string",
"key2" : [ "list" ],
"key3" : { "key4" : "map" }
}
}
},
"Outputs" : {
"CustomResourceAttribute1" : {
"Value" : { "Fn::GetAtt" : ["myUserResource", "responseKey1"] }
},
"CustomResourceAttribute2" : {
"Value" : { "Fn::GetAtt" : ["myUserResource", "responseKey2"] }
}
}
} All properties other than ServiceToken, and all Fn::GetAtt resource
attributes, are defined by the custom resource provider.