Intellipaat Back

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

So I am trying to invoke a simple step function I wrote using a Lambda in python. I am using boto3 for this purpose

client = boto3.client('stepfunctions')

    response = client.start_execution(

        stateMachineArn='aws:states:.......',

        name='dev-yuvi-pipeline-sf',

        input= json.dumps(returnVal)

    )

And I have created an IAM Role which has "AWSStepFunctionsFullAccess" policy

{

    "Version": "2012-10-17",

    "Statement": [

        {

            "Effect": "Allow",

            "Action": "states:*",

            "Resource": "*"

        }

    ]

}

I assign this role to my Lambda, but when I run the lambda I get the following error

An error occurred (AccessDeniedException) when calling the StartExecution operation: User: arn:aws:sts::xxxxxxxx:assumed-role/dev-yuvi-role1/dev-yuvi-pipeline-lambda is not authorized to access this resource: ClientError

dev-yuvi-pipeline-lambda is my Lambda's name and dev-yuvi-role1 is my role name

Can someone help me out here, what am I doing wrong, why can't I invoke the step function from Lambda as I have given it the permissions it needs

1 Answer

0 votes
by (44.4k points)

I think the ARN is wrong, try something like this:

arn:aws:states:us-east-1:xxxxxxxx:stateMachine:dev-yuvi-pipeline-sf

On the web UI, the ARN is not given for the state machine and crosschecked across sample codes.

Related questions

Want to get 50% Hike on your Salary?

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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...