In this section, we will create our first template and deploy the stack using our Gradle script. We can start writing our template by creating a text file named cloudformation.template in the root directory of our project:
$ cd ~/serverlessbook $ touch cloudformation.template
In this section, we will be defining three CloudFormation resources:
- The IAM role
- A custom IAM policy to be attached to the role created earlier
- A Lambda function
For the first resource, we can start with IAM Role, which our Lambda function will use for execution. In the first chapter, we briefly looked at what an IAM Role is. Let's assume that our Lambda function will access S3 buckets in our accounts. How we can allow our Lambda function to access S3 buckets as read-only but prevent it from writing to buckets? These permissions are configured...