sigma

Customizing Function Permissions

Sigma automatically generates the execution permissions for your serverless function based on the API operations used in the code. However in some cases you may need to customize or add to these auto-generated permissions:

You can access the permissions customization dialog via the Permissions button (containing the key icon) on the right side pane of the editor:

Permission Configuration button on right pane

The dialog contains three panes;

Permission Manager dialog

You can edit the permission definitions under Custom Permissions in order to associate additional permissions with your function.

On AWS, a permission generation UI is also available for your convenience, via the Statement Generator button on the top right:

Permission Generator button and pop-up

  1. Under Effects, select whether you want to allow or deny access (in most cases this will be Allow).
  2. Under AWS Service, select the AWS API for which you wish to add the new permission.
  3. Under Actions, select the API operations you wish to invoke from your Lambda.
  4. Under ARN, specify the Amazon Resource Name (ARN) of the resource that Lambda wishes to access (Resource of the IAM permission). The generator will provide a list of fields, which you can fill in order to auto-generate the ARN. Alternatively if you already have the ARN, simply turn off the Guided switch and enter the ARN into the input field.
  5. Click Generate.

For example, if your Lambda function invokes AWS.Textract.DetectDocumentText upon objects stored in a S3 bucket, which requires the textract:DetectDocumentText permission on Textract service and an additional s3:GetObject permission for retrieving the source S3 object from the relevant bucket (say acme.data.ocr), the final custom permissions block would look like this:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Resource": "*",
            "Action": [
                "textract:DetectDocumentText"
            ]
        },
        {
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::acme.data.ocr/*",
            "Action": [
                "s3:GetObject"
            ]
        }
    ]
}

NOTE: If you wish to customize the complete IAM role of your function (e.g. assign a managed policy), you can use the deployment template editor instead; to override the autogenerated IAM role definition.