serverless-framework

How do I setup email configuration for aws cognito user pools?

元气小坏坏 提交于 2019-12-04 07:33:24
I am not sure how to setup the "EmailConfiguration" part of the serverless cloudformation resource section. Does anyone have an example on how to do this? Any guidance would be much appreciated! Here is my serverless.yml file. service: cognito-email-config provider: name: aws runtime: nodejs6.10 region: us-east-1 plugins: - serverless-stack-output custom: output: handler: serverless/output.handler file: outputs/stack.json functions: preSignUp: handler: serverless/preSignUp.handler postConfirmation: handler: serverless/postConfirmation.handler resources: Resources: SESRole: Type: "AWS::IAM:

Serverless framework v1 - multiple resources in one service

限于喜欢 提交于 2019-12-04 04:42:57
问题 I have two resources, games and players, both have crud functions. Are these supposed to be in the same serverless service? I would like to separate them, but how do I then put them in the same api gateway? 回答1: A serverless framework projects deploys a single API Gateway. So if you want it to be in different API Gateways you need separate serverless framework projects. Depending on the size of the services you are making it can make sense or it might not. To merge the two API Gateways higher

How to deploy large python packages with AWS Lambda?

余生颓废 提交于 2019-12-04 02:06:04
问题 I need some advice. I trained an image classifier using Tensorflow and wanted to deploy it to AWS Lambda using serverless. The directory includes the model, some python modules including tensorflow and numpy, and python code. The size of the complete folder before unzipping is 340 MB, which gets rejected by AWS lambda with an error message saying "The unzipped state must be smaller than 262144000 bytes" . How should I approach this? Can I not deploy packages like these on AWS Lambda? Note: In

How could I use aws lambda to write file to s3 (python)?

柔情痞子 提交于 2019-12-03 15:57:41
问题 I have tried to use lambda function to write a file to S3, then test shows "succeeded" ,but nothing appeared in my S3 bucket. What happened? Does anyone can give me some advice or solutions? Thanks a lot. Here's my code. import json import boto3 def lambda_handler(event, context): string = "dfghj" file_name = "hello.txt" lambda_path = "/tmp/" + file_name s3_path = "/100001/20180223/" + file_name with open(lambda_path, 'w+') as file: file.write(string) file.close() s3 = boto3.resource('s3') s3

reading files triggered by s3 event

ε祈祈猫儿з 提交于 2019-12-03 09:14:47
问题 Here is what i want to do : User uploads a csv file onto AWS S3 bucket. Upon file uploaded, S3 bucket invokes the lambda function that i have created. My lambda function reads csv file content, then send email with the file content and info Local environment Serverless framework version 1.22.0 Python 2.7 Here is my serverless.yml file service: aws-python # NOTE: update this with your service name provider: name: aws runtime: python2.7 stage: dev region: us-east-1 iamRoleStatements: - Effect:

How could I use aws lambda to write file to s3 (python)?

只愿长相守 提交于 2019-12-03 05:19:58
I have tried to use lambda function to write a file to S3, then test shows "succeeded" ,but nothing appeared in my S3 bucket. What happened? Does anyone can give me some advice or solutions? Thanks a lot. Here's my code. import json import boto3 def lambda_handler(event, context): string = "dfghj" file_name = "hello.txt" lambda_path = "/tmp/" + file_name s3_path = "/100001/20180223/" + file_name with open(lambda_path, 'w+') as file: file.write(string) file.close() s3 = boto3.resource('s3') s3.meta.client.upload_file(lambda_path, 's3bucket', s3_path) I've had success streaming data to S3, it

How to add a custom domain for a serverless-1.0.0 framework defined/deployed API?

a 夏天 提交于 2019-12-03 02:46:34
问题 Serverless-1.0.0-rc.1 enables to deploy an API to be accessible via a AWS API Gateway. The question: I need the deployed API exposed via a custom domain with SSL certificate instead of the randomly assigned one (URL https://qwertylgbtqert.execute-api.... )? Can that be done from within serverless.yml or serverless framework? Here is my simple service serverless.yml definition: service: my-service provider: name: aws runtime: nodejs4.3 functions: generate: handler: handler.generate events: -

How to add a custom domain for a serverless-1.0.0 framework defined/deployed API?

最后都变了- 提交于 2019-12-02 16:21:31
Serverless-1.0.0-rc.1 enables to deploy an API to be accessible via a AWS API Gateway. The question: I need the deployed API exposed via a custom domain with SSL certificate instead of the randomly assigned one (URL https://qwertylgbtqert.execute-api.... )? Can that be done from within serverless.yml or serverless framework? Here is my simple service serverless.yml definition: service: my-service provider: name: aws runtime: nodejs4.3 functions: generate: handler: handler.generate events: - http: method: get path: url cors: true There is an question which relates to this: the answer here , but

How do I prevent my Slack slash command from echoing into the channel?

谁说胖子不能爱 提交于 2019-12-02 01:11:43
问题 Using Serverless and NodeJS, I have a Slack command set up like: /myCommand doStuff When I type /myCommand doStuff , the Slack output does this: /myCommand doStuff The content of the actual response I want shown goes here. What I want to do is only have this: The content of the actual response I want shown goes here. without the /myCommand doStuff getting echoed. How do I prevent that from happening? Update - adding some code Here's the actual command: module.exports = () => { return new

Serverless framework v1 - multiple resources in one service

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 22:23:53
I have two resources, games and players, both have crud functions. Are these supposed to be in the same serverless service? I would like to separate them, but how do I then put them in the same api gateway? A serverless framework projects deploys a single API Gateway. So if you want it to be in different API Gateways you need separate serverless framework projects. Depending on the size of the services you are making it can make sense or it might not. To merge the two API Gateways higher up you can use API Gateway Custom Domains and proxy the requests based on the path to different API