AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

AWS::CloudFormation::CustomResource

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.

Syntax

{
   "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.

Properties

ServiceToken

The service token that was given to the template developer by the service provider to access the service.

Required: Yes.

Type: String.

Return Values

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.

Examples

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.