AWS SAM Template IAM Policy Generator produces the Policies: section of an AWS::Serverless::Function resource in two modes. SAM Policy Templates mode lets you pick from a curated list of real, published SAM policy templates — S3ReadPolicy, S3CrudPolicy, DynamoDBReadPolicy, DynamoDBCrudPolicy, SQSPollerPolicy, CloudWatchPutMetricPolicy, and more — fill in the one or two parameters each requires (like a bucket or table name), and get the correct YAML with zero hand-written IAM JSON. This is the AWS-recommended approach for common access patterns.
Custom policy mode takes a full IAM policy document you paste and embeds its Statement array as inline JSON directly under Policies:, alongside a Version line — SAM accepts a complete IAM policy document object as a Policies list entry, not only a template name or managed policy ARN. This gives full control for anything a template does not cover: multiple resources, explicit Denies, custom Conditions, or actions no template exposes.
Both modes produce a starting-point Resources.MyFunction snippet with placeholder Handler/Runtime values — merge the Policies: block into your real function's properties.