Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir add
- cd add
- vim main.py
- def add(event, context):
- return event.get('a') + event.get('b')
- zip main.zip main.py
- ### choose any IAM role , edit Trust Relationship
- and copy "Policy Document"
- {
- "Version": "2012-10-17",
- "Statement": [
- {
- "Effect": "Allow",
- "Principal": {
- "Service": "lambda.amazonaws.com"
- },
- "Action": "sts:AssumeRole"
- }
- ]
- }
- save it as 'basic_lambda_role.json'
- aws iam create-role --role-name basic_lambda_role --assume-role-policy-document file:///tmp/basic_lambda_role.json --profile tayseer
- aws lambda create-function --function-name add --zip-file fileb://main.zip --role arn:aws:iam::466775254223:role/basic_lambda_role --handler main.add --runtime python2.7 --profile tayseer
- aws lambda invoke --function-name add --log-type Tail --payload '{"a":1, "b":2 }' --profile tayseer outputfile.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement