Our experts are thinkers AND doers focused on accelerating business outcomes. To showcase our deep expertise, we created a blog series called “The Digital Build.”
CloudFormation is one of the important services in AWS, as it helps us to maintain Infrastructure as a Code (IAAC). Still, some services are not supported by CloudFormation. For example, ‘Cloud Search’ is a service that does not support CloudFormation natively, and to have CloudFormation for these kinds of services, we can adopt the Custom CloudFormation approach.
We have diverse ways to manageIAAC like Terraform, Troposphere, Pulumi, CDK , former2 etc…We need to compile it in such a way that it can be executed in CloudFormation since it is not supported in CloudFormation these tools will not be of help to us.
The only solution for this is to use Custom CloudFormation.
Why Cloud Search?
When we have a large amount of data in the Relational Database, the database engine takes an extremely long time to query the data. In this case, to reduce the amount of time taken, we can go with Cloud Search the data in the RDS can be uploaded to Cloud Search in ‘Json format.’ Once uploaded, based on the items to be searched, the keys can be indexed.
It might take some time to Index, based on the amount of data or the type of Instance we use in Cloud Search. Once it is set up, we should be able to query large data within a few seconds.
What is Custom CloudFormation and how does it work?
Custom CloudFormation extends the functionality of CloudFormation to support services that are not supported natively by CloudFormation.
This work-around goes as follows.
Figure 1: Creation of Cloud Search using Custom CloudFormation
Through CloudFormation, we create a lambda, and it uses AWS SDK to create a necessary service (Cloud Search in our case), and once we receive the success signal which indicates that Cloud Search is created, we will delete the lambda.
Sample lambda function to create and delete cloud search:
Figure 2: Sample lambda function to create and delete Cloud Search
Sample Template to deploy lambda with code:
Figure 3: Sample Template to deploy lambda with code
We can manage Cloud Search using CloudFormation, i.e., by using the template that we usually have for deploying other resources in the Cloud, we can deploy Cloud Search using CloudFormation.