Skip to content

Add API Key capabilities to AWS::Serverless::Api #547

Closed

Description

@mariano-calandra-xp

Hi, I was thinking about API key capabilities to AWS::Serverless::Api resource.

Something like:

  MyRestApi:
    Type: AWS::Serverless::Api
    Properties:
      ...
      ApiKeys: 
        - Enabled: true 
          Name: myFirstApiKey
          UsagePlanId: !Ref MyUsagePlan

  MyUsagePlan: 
    Type: AWS::Serverless::ApiUsagePlan
    Properties:
      Name: String
      Description: String
      Quota: QuotaSettings
      Throttle: ThrottleSettings

That will be translated into:

  MyRestApi:
    Type: AWS::Serverless::Api
    ...

  MyFirstApiKey: 
    Type: AWS::ApiGateway::ApiKey
    DependsOn: 
      - MyUsagePlan
    Properties: 
      Name: MyFirstApiKey
      Enabled: "true"
      StageKeys: 
        - RestApiId: !Ref MyRestApi
          StageName: !Ref MyRestApi.Stage

  MyUsagePlan:
    Type: AWS::ApiGateway::UsagePlan
    DependsOn:
      - MyRestApi
    Properties:
      ApiStages:
      - ApiId: !Ref MyRestApi
        Stage: !Ref MyRestApi.Stage
      UsagePlanName: MyUsagePlan
      Quota: QuotaSettings
      Throttle: ThrottleSettings

  MyUsagePlanKey:
    Type: AWS::ApiGateway::UsagePlanKey
    Properties : 
      KeyId: !Ref MyFirstApiKey
      UsagePlanId: !Ref MyUsagePlan
      KeyType: API_KEY

AWS::Serverless::ApiUsagePlan could be optional with a default.

The current way do the job but it's a little bit more verbose

Does it sound?

Activity

  1. brettstack commented on Aug 10, 2018

    @brettstack
    Contributor

    Absolutely! We've taken our first steps into Auth with #546 and plan on following up with API Keys, AWS_IAM, and Resource Policies. Thanks for the suntan proposal; I'll tag you when I have an RFC up

  2. studds commented on Feb 5, 2019

    @studds

    Any update on this? I'd love to do a PR, but unfortunately python is all ancient greek to me - I'd probably set the effort back months if not years.

  3. brettstack commented on Feb 8, 2019

    @brettstack
    Contributor

    Note I added some instructions in #802 for anyone who wants to submit a PR the instructions should be similar.

  4. added
    contributors/good-first-issue
    on Feb 8, 2019
  5. mkamioner commented on Apr 10, 2019

    @mkamioner

    Any update on this?

  6. jlhood commented on Apr 16, 2019

    @jlhood
    Contributor

    @mkamioner This is not currently prioritized internally so the fastest way to get it implemented would be for a member of the community to contribute the feature. #827 is a good example PR to follow as the changes needed to implement API key support would touch similar areas of the code.

  7. ShreyaGangishetty commented on Sep 13, 2019

    @ShreyaGangishetty

    We have created an RFC #1141 to support creation of Api keys for Auth with Usage Plans. Please let us know your thoughts on the RFC
    @studds @mkamioner once the RFC is finalized we can prioritize this feature. Please post your thoughts on the RFC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributors/good-first-issuetype/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions