Decode base64 encrypted LogResult of "AWS Lambda invoke" in Windows PowerShell Decode base64 encrypted LogResult of "AWS Lambda invoke" in Windows PowerShell powershell powershell

Decode base64 encrypted LogResult of "AWS Lambda invoke" in Windows PowerShell


I am not using Windows, but I head that Bash is available under Linux subsystem also. Inside of every lambda directory I have file invoke.sh with code like this:

NAME=getLineUpMapOUT=/tmp/awsLambdaOut.txtAWS_PROFILE=gms-ai \aws lambda invoke \--function-name $NAME \--payload '{"specs": ["RPM", "Energy"], "numberOfModels": 3}' --log-type Tail \$OUT |grep "LogResult" |awk --field-separator '"' '{print $4}' |base64 --decode |grep --color "$NAME\|$" --textcat $OUT | python3 -m json.tool

Example of output:

START RequestId: cc22c01a-fdd0-4944-9d78-ef298fb6ef72 Version: $LATESTEND RequestId: cc22c01a-fdd0-4944-9d78-ef298fb6ef72REPORT RequestId: cc22c01a-fdd0-4944-9d78-ef298fb6ef72  Duration: 75.75 ms  Billed Duration: 100 ms Memory Size: 3008 MB    Max Memory Used: 63 MB  {    "Models": [        {            "Specs": {                "Energy": "A++",                "RPM": "1200"            },            "Percent": 14        },        {            "Specs": {                "Energy": "A++",                "RPM": "1000"            },            "Percent": 12        },        {            "Specs": {                "Energy": "A+++",                "RPM": "1200"            },            "Percent": 12        }    ],    "Rows": {        "1000": 31,        "1200": 38,        "1400": 29    }}