e. Add IAM Permissions

Add permissions to your lambda

In order to create our cluster we need to add an additional IAM policy.

  1. Go to the Lambda Console (deeplink) and search for ParallelClusterFunction

  2. Select the function then Configuration > Permissions > Click on the role under Role name.

    Attach Policies

  3. Select the AWSXRayDaemonWriteAccess policy and remove it

  4. Select Add permissions > Create inline Policy

    Attach Policies

  5. Click on the JSON tab and paste in the following policy. Make sure to change <account-id> to your aws account id.

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Action": [
                "iam:AttachRolePolicy",
                "iam:DetachRolePolicy"
                ],
                "Effect": "Allow",
                "Resource": "arn:aws:iam::<account-id>:role/parallelcluster/*"
            }
        ]
    }
    
  6. Click Review Policy, give it a name like pcluster-attach-detach-policies and click Save.