0
votes

I need to run some kubectl commands in a lambda function against an EKS cluster. This function will eventually need to query ECR to get the image.I am running into the error described below when using aws-lambda-layer-kubectl

I believe I have correctly deployed the lambda layer as I can see its ARN arn:aws:lambda:us-east-1:xxxxxxxx:layer:kubelambda:1

screenshot of lambda function using aws-lambda-layer-kubectl

The lambda function code looks as follows

lambda function code

However when I run the lambda function I get the following error

/var/task/bootstrap: line 7: aws: command not found
/var/task/bootstrap: line 12: kubectl: command not found

Questions

  1. What is wrong here?
  2. Are there any specific policies to retrieve images from ECR?

Thank you in advance.

1

1 Answers

0
votes

Probably you already figured this out but the layer saves the executables under /opt path as mentioned in the README https://github.com/aws-samples/aws-lambda-layer-kubectl. For aws it is /opt/awscli/aws and for kubectl it is /opt/kubectl/kubectl.