Skip to content

Instantly share code, notes, and snippets.

@mrserverless
Last active November 24, 2018 10:07
Show Gist options
  • Save mrserverless/0cfec7959d8e0134a19bc3700e0cfc76 to your computer and use it in GitHub Desktop.
Save mrserverless/0cfec7959d8e0134a19bc3700e0cfc76 to your computer and use it in GitHub Desktop.
API Gateway ResourcePolicy
Resources:
MyAPI:
Type: AWS::Serverless::Api
Properties:
StageName: dev
DefinitionBody:
swagger: 2.0
info:
title: !Ref AWS::StackName
x-amazon-apigateway-policy:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal: "*"
Action: execute-api:Invoke
Resource: !Sub arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:*
Condition:
IpAddress:
aws:SourceIp: !If
- ProdDeployment
- [ "10.0.0.1" ]
- [
"10.0.0.2", # you can
"10.0.0.3/32", # list them
"10.0.0.4/32" # like this
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment