aws-sam-cli

aws-sam-local environment variables

南笙酒味 提交于 2020-01-22 13:15:45
问题 I am following the readme here: https://github.com/awslabs/aws-sam-local I have a lambda written in python 3.6 and its similar to the helloworld example here : https://github.com/awslabs/aws-sam-local/tree/develop/samples/hello-world/python template.yml looks as such: AWSTemplateFormatVersion : '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: MyFunction1 API Resources: MyFunction1: Type: AWS::Serverless::Function Properties: FunctionName: MyFunction1 Handler: lambda_module

Running AWS SAM projects locally get error

放肆的年华 提交于 2020-01-13 08:32:26
问题 I am trying to run an AWS Lambda project locally on Ubuntu. When I run the project with AWS SAM Local it shows me this error: Error: Running AWS SAM projects locally requires Docker. Have you got it installed? 回答1: I had trouble installing it on Fedora. When I followed the Docker postinstall instructions I managed to get past this issue. https://docs.docker.com/install/linux/linux-postinstall/ I had to: Delete the ~/.docker directory; Create the "docker" group; Add my user to the "docker"

How to get stack output from AWS SAM?

大憨熊 提交于 2019-12-23 16:43:19
问题 I would like to perform automatic integration tests on my serverless projects. To do that, I need to get the api endpoints somehow. There is already the plugin serverless-stack-output for Serverless framework that serves the purpose. But I'm wondering how can I achieve similar thing by AWS SAM after I deploy my application? Meanwhile, If I can somehow get my api's base url as well as individual endpoints, then I'm able to connect them and and perform tests against them. 回答1: As AWS SAM builds

API Gateway HTTP Proxy integration with aws-sam (NOT Lambda Proxy)

拟墨画扇 提交于 2019-12-23 10:47:08
问题 I am trying to use aws-sam to develop / simulate my API Gateway locally. My API gateway makes liberal use of the HTTP proxy integrations. The production Resource looks like this: All of the aws-sam examples which I've found, as well as related documentation and Q&A, use the Lambda integrations / have a hard dependency on a Lambda function being the proxied resource, versus an HTTP Proxy integration. Is there a way to define an HTTP Proxy resource for an aws-sam application? (As opposed to a

Recommended Project Structure for multi-function SAM Template

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 08:47:47
问题 I have a new project that requires a relatively small amount of services, maybe 10 or less (and therefore it is not economical to place each in a separate project repository). Each service will be defined as an AWS::Serverless::Function via SAM Template. My question is: what is the recommended way to organize or structure such a project? Currently the structure is: |- src |- lambdas |- service-one |- stuff |- package.json |- service-two |- stuff |- package.json |- other-stuff |- test |-

AWS lambda nodejs runtime: io: read/write on closed pipe

你说的曾经没有我的故事 提交于 2019-12-19 08:17:10
问题 I am trying to execute a couple of async requests from a lambda function. The first call resolveEndpoints() succeeds and the second fails with 2017/11/03 17:13:27 Function oauth.callbackHandler timed out after 3 seconds 2017/11/03 17:13:27 Error invoking nodejs6.10 runtime: io: read/write on closed pipe The handler is: exports.callbackHandler = async (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; let endpoints: any = await resolveEnpoints(); config

Unable to install aws-sam-cli using pip on Windows 10

会有一股神秘感。 提交于 2019-12-11 18:23:40
问题 I'm at my wits end. I'm trying to install aws-sam-cli so that I can test AWS Lambda functions locally. I've followed all the tutorials I can find but I'm stuck. I've installed docker and python 3.7 onto my local machine but when I try to install aws-sam-cli using: pip install aws-sam-cli I get the following error: Could not find a version that satisfies the requirement pypiwin32==220; sys_platform == "win32" and python_version >= "3.6" (from docker>=3.3.0->aws-sam-cli) (from versions: 219,

Does AWS SAM CodePipelines do whole rebuild per commit?

做~自己de王妃 提交于 2019-12-11 14:48:27
问题 I am building a distributed app in AWS consisting of base resource (iam etc), data-warehousing but mostly serverless resources like lambdas, sns, mongodb,.. For deploying this over an OTAP I am looking into AWS tooling for this, mostly outlined here. This means that the 1 repo in CodeCommit will trigger the CodePipeline, which will have these components in de right places (realizing order control): deploying CF stacks using CodeBuild to package (AWS sam package) a SAM resource-> for every SAM

Why sam package publishes the artifacts to bucket?

不羁岁月 提交于 2019-12-11 07:49:14
问题 As part of packaging the SAM application, the application published to s3 bucket as shown below: sam package --template-file sam.yaml --s3-bucket mybucket --output-template-file output.yaml Why sam package provides --s3-bucket option? Is this mandatory option? What is the purpose of publishing artifacts to s3 bucket? 回答1: --s3-bucket option in sam package command is mandatory. What the command does is that it takes your local code, uploads it to S3 and returns transformed template where

pip install of aws-sam-cli package with python3.7 version

醉酒当歌 提交于 2019-12-11 06:34:52
问题 In the below docker file: FROM alpine:latest ENV HOME /home/samcli ENV PATH $HOME/.local/bin:$PATH RUN mkdir /root/bin /aws; \ apk add --no-cache groff less bash python jq curl py-pip tzdata RUN ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime RUN apk add --no-cache --virtual .build-deps gcc python2-dev python3-dev linux-headers musl-dev && \ pip install --upgrade pip; \ adduser samcli -Du 5566; \ chown -R samcli $HOME; USER samcli WORKDIR $HOME RUN pip install --user --upgrade awscli aws