ilyabezdelev / aws-cli-lambda

A script to package AWS CLI as a Lambda Layer
MIT License
29 stars 32 forks source link

Unable to test - awscli missing #2

Open miryee opened 5 years ago

miryee commented 5 years ago

I followed the steps outlined in https://bezdelev.com/hacking/aws-cli-inside-lambda-layer-aws-s3-sync/

I can use aws command inside the virtualenv on my linux box and I verified the environment path is set to #!/var/lang/bin/python in aws_completer.

The versions I have in my virtual environment are: aws-cli 1.16.196 Python 3.6.8 Linux 4.18.0-25-generic botocore 1.12.186 pip 19.1.1 from .home/myee/AWS/awscli-virtualenv/lib/python3.6/site-packages/pip (python 3.6)

Trying to run a test in a lambda function that only executes "/opt/aws --version", it produces an error that awscli cannot be found. When I run the same lambda function that only executes "which aws" it returns which: no aws in (/var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin)

Any suggestions?

ybudimirov commented 5 years ago

Followed article, received error in CloudWatch:

File "/opt/aws", line 19, in import awscli.clidriver ModuleNotFoundError: No module named 'awscli'

awscli-lambda-layer.zip was built on ubuntu 18, python 3.6.

autodeck commented 4 years ago

I have the same problem as above. Has anyone managed to actually get this working?

vibhor2006 commented 4 years ago

+1 on the problem. Anyone found a fix?

ybudimirov commented 4 years ago

@autodeck @vibhor2006 Sorry for late reply As far as i remember i have used this: https://github.com/aws-samples/aws-lambda-layer-awscli/blob/master/build.sh

tnguyen1 commented 3 years ago

Hi there, I've just submitted this pull request https://github.com/ilyabezdelev/aws-cli-lambda/pull/6 to fix scripts while packaing the zip. This solved the ModuleNotFoundError: No module named 'awscli' error for me. HTH

Anon-Exploiter commented 3 years ago

image

Built and uploaded the layer.

Anon-Exploiter commented 3 years ago

Update:

Got the binary working by calling:

/opt/aws instead of aws .. -- makes sense since /opt/ isn't in $PATH