aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.6k stars 4.14k forks source link

Package command uploads entire directory when using SAM InlineCode #3763

Open brettstack opened 6 years ago

brettstack commented 6 years ago

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.

debora-ito commented 5 years ago

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

Pinging @sanathkr for thoughts.

zoellner commented 4 years ago

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

david-katz commented 2 years ago

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....