AWS CloudFormation CustomResource ServiceToken Configuration

AWS CloudFormation CustomResource ServiceToken Configuration

Prev Question Next Question

Question

You are creating CloudFormation templates for new applications.

In the templates, you need to include certain custom resources as they are not supported by the AWS CloudFormation resource types.

You want to use the AWS::CloudFormation::CustomResource resource type to specify the custom resources.

The resource type has a ServiceToken property that determines where AWS CloudFormation sends requests to.

Which of the following endpoints can you configure in the ServiceToken property? (Select TWO.)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answers: A & E.

Option A is CORRECT because you can configure an SNS topic ARN to receive the service token such as "arn:aws:sns:us-east-1:84969EXAMPLE:CRTest".

Options B, C and D are incorrect because you cannot configure SQS, CloudWatch Event rule or Step Function in the ServiceToken property.

Option E is CORRECT because a CloudFormation custom resource can send the service token to a Lambda function.

Please check the following references for the details.

References:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html, https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cfn-customresource.html

Sure, I'd be happy to explain!

AWS CloudFormation is a service that helps you model and set up your Amazon Web Services resources so you can spend less time managing those resources and more time focusing on your applications. With CloudFormation, you create a template that describes all the AWS resources that you want to create and configure for your application.

However, not all AWS resources can be modeled or created directly in CloudFormation templates. In some cases, you might need to use custom resources to provide additional functionality or to use resources that are not supported natively by CloudFormation. AWS CloudFormation provides the AWS::CloudFormation::CustomResource resource type to handle such custom resources.

When using the AWS::CloudFormation::CustomResource resource type, you must specify a value for the ServiceToken property. The ServiceToken property determines where AWS CloudFormation sends requests to when it creates, updates, or deletes the custom resource.

Here are the options for endpoints that can be configured in the ServiceToken property:

A. An Amazon SNS topic ARN: When you specify an Amazon SNS topic ARN, AWS CloudFormation sends requests to the specified topic, and you can create an SNS subscription to receive the requests.

B. An Amazon SQS queue ARN: When you specify an Amazon SQS queue ARN, AWS CloudFormation sends requests to the specified queue, and you can set up an SQS queue notification to receive the requests.

C. A CloudWatch Event rule ARN: When you specify a CloudWatch Event rule ARN, AWS CloudFormation sends events to the specified rule, and you can create a rule to match the events and take action.

D. An AWS Step Function name: When you specify an AWS Step Function name, AWS CloudFormation sends requests to the specified Step Function, and you can set up a Step Function to handle the requests.

E. A Lambda function ARN: When you specify a Lambda function ARN, AWS CloudFormation sends requests to the specified Lambda function, and you can create a Lambda function to handle the requests.

So, the correct answer is A and E. You can configure an Amazon SNS topic ARN or a Lambda function ARN in the ServiceToken property when using the AWS::CloudFormation::CustomResource resource type.