Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

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

1 Answer

0 votes
by (44.4k points)

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

}

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...