aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Package command uploads entire directory when using SAM InlineCode

Open brettstack opened this issue 7 years ago • 3 comments

SAM recently released support for InlineCode, however, when the package command gets run it zips+uploads the entire current directory (even though it doesn't get used). I believe this is the issue https://github.com/aws/aws-cli/blob/d0fd4d2e2856e441156c0ba333eb119c7abd977e/awscli/customizations/cloudformation/artifact_exporter.py#L125.

Repro:

Create a SAM template with the following Resource:

MyFunction:
    Type: AWS::Serverless::Function
    Properties:
      InlineCode: |
        exports.handler = async (event) => {
          return event
        }
      Handler: index.handler
      Runtime: nodejs8.10

Run aws cloudformation package command.

Result: You can see the entire current directory gets zipped and uploaded to S3.

Expected: It doesn't.

brettstack avatar Nov 28 '18 00:11 brettstack

Hi @brettstack, seems a reasonable request, marking as a feature request.

Pinging @sanathkr for thoughts.

debora-ito avatar Jan 23 '19 18:01 debora-ito

This is a related issue: https://github.com/awslabs/aws-sam-cli/issues/1644 sam-cli fixed an issue with upload when InlineCode is used, aws-cli still has the same issue

zoellner avatar Feb 13 '20 01:02 zoellner

Just ran into this in 2022 on aws-cli/2.7.32 Python/3.9.11 Darwin/19.6.0 exe/x86_64 prompt/off aws cli uploaded a 300MB zip archive for my inline lambda@edge function....

david-katz avatar Sep 15 '22 17:09 david-katz