Template

This is the .yaml file for sam app to the lambda script that imports all ec2 details and outputs them in an s3 bucket with .csv file format.
mail@pastecode.io avatar
unknown
yaml
a year ago
1.0 kB
1
Indexable
Never
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A simple SAM application to collect EC2 details and publish CSV files to an S3 bucket.

Globals:
  Function:
    Timeout: 10

Resources:
  CollectEC2DetailsFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: .
      Handler: lambda_function.lambda_handler
      Runtime: python3.8
      Policies:
        - AWSLambdaExecute
        - Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Action:
                - s3:PutObject
                - s3:GetObject
              Resource:
                - arn:aws:s3:::<your-s3-bucket-name>/*
        - Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Action:
                - ec2:Describe*
              Resource: '*'
Outputs:
  CollectEC2DetailsFunction:
    Description: "Collect EC2 Details Lambda Function"
    Value: !Ref CollectEC2DetailsFunction