sapessi / serverless-sam

Serverless framework plugin to export AWS SAM templates for a service
Apache License 2.0
150 stars 26 forks source link

Make CodeUri configurable #16

Open tmclaugh opened 6 years ago

tmclaugh commented 6 years ago

I'm trying to use serverless-sam to generate a SAM template for my projects, so people outside my organization can deploy with CloudFormation. I want to be able to control the CodeUri value so I can point the template to an S3 bucket path. I'm sure it's a trivial change but I have no clue what I'm doing with JavaScript.

sapessi commented 6 years ago

Hey @tmclaugh, the beauty of using SAM is that you don't have to package and upload the code yourself. You can keep CodeUri as a relative path to the local folder that contains your code. Then, run the aws cloudformation package --template-file you-sam.yaml --output-template-file output-sam.yaml to zip up the code, upload it to S3, and prepare a SAM template for deployment in one command.

tmclaugh commented 6 years ago

I'm just figuring this out now as I read the docs closer. Seriously, this is super awesome and I think this solves an issue that's been bugging me for a bit!

tmclaugh commented 6 years ago

Sorry to reopen this, partially because I'm blocked by #18 in confirming this, but I believe when releasing a version on AppRepo, the CodeURI needs to point to an S3 object. This makes making codeuri configurable useful.

disbelief commented 5 years ago

I too have need of a configurable CodeUri output to the template YAML file.

My use case is that I'm using the AWS SAM CLI to invoke & debug my functions locally (and I'm also using the new AWS Toolkit for VS Code, which wraps aws-sam-cli).

Currently, I have to manually edit the template file and change all the CodeUris to the relative local path to the source file for each lambda function.

Ideally I'd be able to specify different CodeUri depending on whether I'm deploying the function locally (use local relative path), or into the real AWS cloud (use .serverless/ zip file path).

muchezz commented 2 years ago

You guys found a work-around or a solution to this?