Skip to content

Instantly share code, notes, and snippets.

@uc-compass-bot
Created November 13, 2019 21:15
Show Gist options
  • Save uc-compass-bot/78cad7a91ba000a954f9425326c60de2 to your computer and use it in GitHub Desktop.
Save uc-compass-bot/78cad7a91ba000a954f9425326c60de2 to your computer and use it in GitHub Desktop.
service: partition-cloudfront-logs
custom:
buckets:
staging: staging-bucket-name
production: production-bucket-name
BUCKET: ${self:custom.buckets.${self:provider.stage}}
athena_table:
staging: staging_partitioned
production: production_partitioned
ATHENA_TABLE: ${self:custom.athena_table.${self:provider.stage}}
provider:
name: aws
runtime: python3.7
stage: ${opt:stage, 'staging'}
region: us-east-1
deploymentBucket:
name: ${self:custom.BUCKET}
serverSideEncryption: AES256
deploymentPrefix: serverless
timeout: 30
iamRoleStatements:
- Effect: Allow
Action:
- s3:ListBucket
Resource: "arn:aws:s3:::${self:custom.BUCKET}"
# ...
functions:
partition:
handler: partition.lambda_handler
environment:
ATHENA_TABLE: "cloudfront_logs.${self:custom.ATHENA_TABLE}"
events:
- s3:
bucket: ${self:custom.BUCKET}
event: s3:ObjectCreated:*
rules:
- prefix: raw/
existing: true
package:
exclude:
- 'venv/**'
- '__pycache__/**'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment