'Options to call s3 objects inside shell script from lambda?
I have quite a lot of shell scripts running in linux server. Planning to migrate to cloud. Some functionalities of the script include,
- Moving list of files from one folder to another/to different server
- Business logic included to process the files
- Encryption/Decryption of files with ssh keys
Am trying to run the bash script on lambda . But When I try to call s3 bucket using AWS CLI command inside my bash script. Lambda Fails with run time error.
function handler () {
be_bucketname=$1
# Check whether the bucket already exists.
# We suppress all output - we're interested only in the return code.
aws s3api head-bucket \
--bucket s3://mybucket \
>/dev/null 2>&1
if [[ ${?} -eq 0 ]]; then
return 0 # 0 in Bash script means true.
else
return 1 # 1 in Bash script means false.
fi
RESPONSE="{\"statusCode\": 200, \"body\": \"be_bucketname\"}"
echo $RESPONSE
}
So how can I read s3 objects using shell scripts from Lambda. If I use Python to call shell script will aws cli works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
