Created
May 8, 2021 06:43
-
-
Save dobeerman/52d092aab24a1bb9c806d4fac617f20e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: 2010-09-09 | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: HTTP API to EventBridge with Custom Domain | |
| Parameters: | |
| DomainName: | |
| Type: String | |
| Description: Domain name for api | |
| Resources: | |
| CustomBus: | |
| Type: AWS::Events::EventBus | |
| Properties: | |
| Name: DemoBus | |
| HttpApi: | |
| Type: AWS::Serverless::HttpApi | |
| Properties: | |
| DefinitionBody: | |
| "Fn::Transform": | |
| Name: "AWS::Include" | |
| Parameters: | |
| Location: "./api.yml" | |
| HttpApiMapping: | |
| Type: AWS::ApiGatewayV2::ApiMapping | |
| Properties: | |
| ApiId: !Ref HttpApi | |
| DomainName: !Ref DomainName | |
| Stage: !Ref HttpApiApiGatewayDefaultStage | |
| ApiMappingKey: !Sub "${AWS::StackName}" | |
| HttpApiRole: | |
| Type: "AWS::IAM::Role" | |
| Properties: | |
| AssumeRolePolicyDocument: | |
| Version: "2012-10-17" | |
| Statement: | |
| - Effect: "Allow" | |
| Principal: | |
| Service: "apigateway.amazonaws.com" | |
| Action: | |
| - "sts:AssumeRole" | |
| Policies: | |
| - PolicyName: ApiDirectWriteEventBridge | |
| PolicyDocument: | |
| Version: "2012-10-17" | |
| Statement: | |
| Action: | |
| - events:PutEvents | |
| Effect: Allow | |
| Resource: !GetAtt CustomBus.Arn | |
| Outputs: | |
| ApiEndpoint: | |
| Description: "Demo HTTP API endpoint URL with Custom domain" | |
| Value: !Sub "https://${DomainName}/${AWS::StackName}/{source}/{detailType}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment