Skip to content

Instantly share code, notes, and snippets.

@ronyis
ronyis / handler.py
Created November 13, 2018 23:19
Python Lambda handler example using serverless-package-external
import common.utils
def my_function(event, context):
common.utils.print_message('Hello World!')
@ronyis
ronyis / serverless.yml
Created November 13, 2018 23:03
Example of a `serverless-package-external` usage
service: package-external-example
provider:
name: aws
runtime: python3.6
custom:
packageExternal:
external:
- '../common'
import os
import json
import boto3
client = boto3.client('stepfunctions')
def run(event, context):
client.start_execution(
stateMachineArn=os.environ['CF_MyStateMachine'],
name=str(context.aws_request_id),
@ronyis
ronyis / serverless.yml
Last active June 1, 2018 11:22
Example of a Serverless system with Step Functions invoked by SNS
service: state-machine-invoking-example
provider:
name: aws
region: eu-west-1
runtime: python3.6
# Specific Role for the Lambda and machine is better
iamRoleStatements:
- Effect: "Allow"
Action: