How to do it...

  1. Start by defining the template version and description:
      AWSTemplateFormatVersion: "2010-09-09"       Description: Flow logs for networking resources
  1. Define the Parameters for the template. In this case, it is just the VpcId to turn logging on for:
      Parameters:         VpcId:           Type: String           Description: The VPC to create flow logs for
  1. Create the Resources section of the template and define the log group to use to send our flow-logs to:
      Resources:         LogGroup:           Type: AWS::Logs::LogGroup           DeletionPolicy: Delete           Properties:             LogGroupName: LogGroup
  1. Next we define the IAM role that will give the flow-logs service permission to write the logs:
        IamRole:           Type: AWS::IAM::Role           Properties:             AssumeRolePolicyDocument:  Version: "2012-10-17" ...

Get AWS Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.