Skip to content

Instantly share code, notes, and snippets.

@og24715
Created February 20, 2018 04:46
Show Gist options
  • Save og24715/8a6415d159c87d84c7d3f72ab76f7a2d to your computer and use it in GitHub Desktop.
Save og24715/8a6415d159c87d84c7d3f72ab76f7a2d to your computer and use it in GitHub Desktop.
twitter api proxy
service: httpProxy
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: ap-northeast-1
resources:
Resources:
TwitterApiProxy:
Type: AWS::ApiGateway::RestApi
Properties:
Name: twitter-api-proxy
Description: 'TwitterAPIのHTTPプロキシ'
TwitterApiBasePath:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Fn::GetAtt:
- TwitterApiProxy
- RootResourceId
PathPart: 'twitter'
RestApiId:
Ref: TwitterApiProxy
TwitterApiProxyPath:
Type: AWS::ApiGateway::Resource
Properties:
ParentId:
Ref: TwitterApiBasePath
PathPart: '{proxy+}'
RestApiId:
Ref: TwitterApiProxy
TwitterApiProxyAnyMethod:
Type: AWS::ApiGateway::Method
Properties:
AuthorizationType: NONE
HttpMethod: ANY
Integration:
IntegrationHttpMethod: ANY
Type: HTTP_PROXY
Uri: https://api.twitter.com/{proxy}
PassthroughBehavior: WHEN_NO_MATCH
RequestParameters:
'integration.request.path.proxy': 'method.request.path.proxy'
MethodResponses:
- StatusCode: 200
RequestParameters:
'method.request.path.proxy': true
ResourceId:
Ref: TwitterApiProxyPath
RestApiId:
Ref: TwitterApiProxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment