Back
Is there ANY way to execute aws-cli inside AWS Lambda? It doesn't seem to be pre-installed. (I've checked with "which aws" via Node.js child-process, and it didn't exist.)
AWS Lambda allows you to use layers now. Check this Github repo for Bash layer with aws-cli - Bash Lambda Layer
handler () { set -e # Event Data is sent as the first parameter EVENT_DATA=$1 # This is the Event Data echo $EVENT_DATA # Example of command usage EVENT_JSON=$(echo $EVENT_DATA | jq .) # Example of AWS command that's output will show up in CloudWatch Logs aws s3 ls # This is the return value because it's being sent to stderr (>&2) echo "{\"success\": true}" >&2}
handler () {
set -e
# Event Data is sent as the first parameter
EVENT_DATA=$1
# This is the Event Data
echo $EVENT_DATA
# Example of command usage
EVENT_JSON=$(echo $EVENT_DATA | jq .)
# Example of AWS command that's output will show up in CloudWatch Logs
aws s3 ls
# This is the return value because it's being sent to stderr (>&2)
echo "{\"success\": true}" >&2
}
Learn how we helped 50,000+ professionals like you !
31k questions
32.8k answers
501 comments
693 users