I run this to deploy my lambda:
sam package --template-file prod_template.yaml --s3-bucket mybucket --output-template-file packaged-template.yaml
sam deploy --template-file packaged-template.yaml --stack-name mystack --capabilities CAPABILITY_IAM
That works but this code is version controlled and sam is also uploading the .git folder. How do I have sam ignore some folders like I can with gitignore?
Deletes an AWS SAM application by deleting the AWS CloudFormation stack, the artifacts that were packaged and deployed to Amazon S3 and Amazon ECR, and the AWS SAM template file.
To have the AWS SAM CLI create these repositories, use either the --resolve-image-repos option or the --guided option, and then respond to the subsequent prompt with Y . Specify this option to have the AWS SAM CLI use prompts to guide you through the deployment.
The sam package and sam deploy commands are used to update and trigger the deployment of your Lambda function. You executed these commands in Package the AWS SAM application and Deploy the AWS SAM application.
Packages an AWS SAM application. This command creates a . zip file of your code and dependencies, and uploads the file to Amazon Simple Storage Service (Amazon S3).
You need to check you're supplying a valid CodeUri
path in your template, it should look something like this:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
Followers:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./src
Handler: lambda.handler
Runtime: nodejs12.x
Timeout: 300
The AWS docs state that if the CodeUri
is not supplied, the entire working directory will be zipped and uploaded (which I think is what you're experiencing).
If you specify a file [in CodeUri], the command directly uploads it to the S3 bucket. If you specify a folder, the command zips the folder and then uploads the .zip file. For most resources, if you don't specify a path, the command zips and uploads the current working directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With