Skip to content

Instantly share code, notes, and snippets.

@aidansteele
Created July 21, 2020 22:23
Show Gist options
  • Save aidansteele/7e264ca046be0def45b79bb4bc34fceb to your computer and use it in GitHub Desktop.
Save aidansteele/7e264ca046be0def45b79bb4bc34fceb to your computer and use it in GitHub Desktop.
Parameters:
SecurityGroupIds:
Type: List<AWS::EC2::SecurityGroup::Id>
SubnetIds:
Type: List<AWS::EC2::Subnet::Id>
Resources:
Api:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: Your HTTP api
Description: Aw yis
ProtocolType: HTTP
Stage:
Type: AWS::ApiGatewayV2::Stage
Properties:
ApiId: !Ref Api
AutoDeploy: true
StageName: $default
VpcLink:
Type: AWS::ApiGatewayV2::VpcLink
Properties:
Name: Your API GW link
SecurityGroupIds: !Ref SecurityGroupIds
SubnetIds: !Ref SubnetIds
Service1:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref Api
ConnectionId: !Ref VpcLink
ConnectionType: VPC_LINK
IntegrationMethod: ANY
IntegrationType: HTTP_PROXY
IntegrationUri: arn:aws:elasticloadbalancing:ap-southeast-2:01234567890:listener/app/myalb/743c7bf16900000/c19b2febdf30000
PayloadFormatVersion: 1.0
Route:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId: !Ref Api
RouteKey: ANY /api/service1/v1/{proxy+}
Target: !Sub integrations/${Service1}
Outputs:
ApiId:
Value: !Ref Api
ApiDomain:
Value: !Sub ${Api}.execute-api.${AWS::Region}.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment