gkrizek/bash-lambda-layer

Problem with aws command

Opened this issue · 1 comments

I just trying to execute something like this, but is not working
aws iot attach-principal-policy --policy-name 'G4APPTV' --principal 'us-west-2:03ee51b1-1ffe-456c-ae6b-0a2c9d610f70'

the role of the lambda has admin credentials, i dont sure what's going on

this is all the code

#!/bin/bash

handler () {
    set -e
    EVENT_DATA=$1
    identityId=`echo "$EVENT_DATA" | jq -r ".request.userAttributes" | sed -e "s/custom:identityId/identityId/g" | jq -r '.identityId'` 
    aws iot attach-principal-policy --policy-name 'G4APPTV' --principal 'us-west-2:03ee51b1-1ffe-456c-ae6b-0a2c9d610f70'
    echo "{\"success\": true}" >&2
}

Can you help with that?

ty

You could check to make sure it's using the role correctly by running this in your function:

aws sts get-caller-identity

I would start there and make sure it's using the right role