Using Existing Resources
Stackery enables you to integrate your serverless applications with existing resources of the following types:
- Lambda Function
- DynamoDB Table
- Kinesis Stream
- SQS Queue
- SNS Topic
- RDS Database
- Virtual Private Cloud
A common use case is the conditional creation of resources depending on the environment. This allows you to express your intent at a high level, which Stackery then translates into Infrastructure as Code that can achieve a scenario such as the following: In the staging and production environments, the application stack will utilize an existing resource, but in integration and testing environments the application will provision/de-provision a new resource.
DynamoDB Example
Let's say you're working on a new application and you decide that you'd like to connect a function to an existing DynamoDB table. All you need to do is drag and drop a Table resource onto the editor canvas, double click on the table, check the box that says Use Existing DynamoDB Table, and paste the ARN of the resource.
What's an ARN? See the AWS docs for full documentation.
Serverless in the real world
Let's add some color to this hypothetical scenario by illuminating how two separate teams maintaining separate applications go about working with the same resource.
The "User Services Team" maintains an application stack consisting of several Lambda functions that perform CRUD actions against a DynamoDB table called "Users". This team has designed the application stack and the table according to their requirements. The table in their stack is not considered an existing resource, since the table was created and provisioned within this stack.
Some time later the "Dashboard Team" is modifying a separate application stack with a new feature that requires accessing the existing "Users" DynamoDB table. Too easy! This is exactly what an existing resources enables. Just drag and drop a "Table" resource onto the editor canvas, double click on the table, check the box that says Use Existing DynamoDB Table, and paste the ARN of the resource. This ability to reference an existing resource tells Stackery to not provision this table, but rather to reference it by its ARN.