Cloudformation Resources
AWS Cloudformation configuration is AWS's native way to manage infrastructure as a code.
In Stacktape, you can use the cloudformationResources
section to extend your Stacktape template with AWS
Cloudformation resources. This enables you to easily configure, manage and interconnect Cloudformation resources with
other resources of your stack. As a result, you are able to leverage full power of AWS in a single unit
configuration.
Usage
Example
The following example shows a Stacktape template with SNS topic (SNS is AWS managed messaging service).
cloudformationResources:MySnsTopic:type: AWS::SNS::Topic
The next example is extension of previous one. Infrastructure includes:
- MySnsTopic - SNS topic - used as communicator between functions
- processData - function - processing function. If failure occurs, message is sent into MySnsTopic
- analyzeError - function - is invoked once MySnsTopic receives failure message from processData and analyzes the failue.
- slackNotify - function - is invoked once MySnsTopic receives failure message from processData and sends notification about the failure.
cloudformationResources:MySnsTopic:type: AWS::SNS::Topicresources:processData:type: 'function'properties:packageConfig:filePath: 'lambdas/process.ts'destinations:onFailure: $Param('MySnsTopic', 'Arn')analyzeError:type: 'function'properties:packageConfig:filePath: 'lambdas/analysis.ts'events:- type: snsproperties:topicArn: $Param('MySnsTopic', 'Arn')slackNotify:type: 'function'properties:packageConfig:filePath: 'lambdas/notify.ts'events:- type: snsproperties:topicArn: $Param('MySnsTopic', 'Arn')