Skip to content

Feature request: Support for 'SecurityPolicy' property to 'AWS::Serverless::Api' #8519

Closed

Description

@arbzkhan

Describe the feature

Currently, while creating the resource 'AWS::Serverless::Api'[1], there is no property to set a Security policy. Instead, we have a sub-property under 'DomainConfiguration' that creates a separate resource 'AWS::ApiGateway::DomainName'[2]. That said, we could directly add a new 'SecurityPolicy' property under 'AWS::Serverless::Api', which would apply the Security policy similar to console/API usage for the REST API resource 'AWS::ApiGateway::RestApi'.

[1] https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html
[2] https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-api.html#sam-api-domain

Replication:

Since this property doesn't exist, we will get the following expected error with 'sam build':


Error: [InvalidResourceException('property SecurityPolicy not defined for resource of type AWS::Serverless::Api')]


Workarounds:

  1. Import the resource 'AWS::ApiGateway::RestApi' into the stack.
  2. Create the REST API resource 'AWS::ApiGateway::RestApi' directly in the SAM template to use the 'SecurityPolicy' property.

Proposed Solution:

Add a new property 'SecurityPolicy' to resource 'AWS::Serverless::Api' which will add the Security policy similar to console/API usage to the REST API resource directly 'AWS::ApiGateway::RestApi'.

Activity

  1. added
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Dec 18, 2025
  2. ryanwdale commented on Jan 7, 2026

    @ryanwdale
  3. removed
    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.
    on Jan 26, 2026
  4. bnusunny commented on Jan 26, 2026

    @bnusunny
    Contributor

    This needs to be added in SAM Translator first. Here is the PR for that.

  5. roger-zhangg commented on Jul 2, 2026

    @roger-zhangg
    Member

    Closing — this feature has been implemented and shipped.

    The SAM Transform PR aws/serverless-application-model#3872 added SecurityPolicy support to AWS::Serverless::Api and was merged on 2026-01-27. SAM CLI has since picked up the updated translator (1.111.0 as of today).

    If you're on the latest SAM CLI version, you can now use SecurityPolicy directly on your AWS::Serverless::Api resource. Thanks for the feature request!

  6. github-actions commented on Jul 2, 2026

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please either tag a team member or open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions