Skip to content

Commit

Permalink
Create prototype deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kdid committed Jun 21, 2023
1 parent e279deb commit 78b8397
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,71 +545,71 @@ Resources:
Type: AWS::Serverless::HttpApi
Properties:
StageName: latest
rootRedirect:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./redirect
Handler: index.handler
Timeout: 1
Description: Redirects to latest version of docs
Environment:
Variables:
REDIRECT_TO: /docs/v2/index.html
Events:
RedirectApiGet:
Type: HttpApi
Properties:
ApiId: !Ref rootApi
Path: /
Method: GET
RedirectApiHead:
Type: HttpApi
Properties:
ApiId: !Ref rootApi
Path: /
Method: HEAD
# rootRedirect:
# Type: AWS::Serverless::Function
# Properties:
# CodeUri: ./redirect
# Handler: index.handler
# Timeout: 1
# Description: Redirects to latest version of docs
# Environment:
# Variables:
# REDIRECT_TO: /docs/v2/index.html
# Events:
# RedirectApiGet:
# Type: HttpApi
# Properties:
# ApiId: !Ref rootApi
# Path: /
# Method: GET
# RedirectApiHead:
# Type: HttpApi
# Properties:
# ApiId: !Ref rootApi
# Path: /
# Method: HEAD

# Documentation
docsMapping:
Type: AWS::ApiGatewayV2::ApiMapping
Properties:
DomainName: !Sub "${CustomDomainHost}.${CustomDomainZone}"
ApiId: !Ref rootApi
Stage: !Ref rootApilatestStage
DependsOn: dcApi
docsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "${CustomDomainHost}-docs.${CustomDomainZone}"
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
docsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: 2012-10-17
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Principal: "*"
Action: "s3:GetObject"
Resource: !Sub "arn:aws:s3:::${docsBucket}/*"
Bucket: !Ref docsBucket
docsIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref rootApi
IntegrationMethod: GET
IntegrationType: HTTP_PROXY
IntegrationUri: !Sub "http://${docsBucket}.s3-website-us-east-1.amazonaws.com/{proxy}"
PayloadFormatVersion: "1.0"
docsRoute:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId: !Ref rootApi
AuthorizationType: NONE
RouteKey: GET /docs/v2/{proxy+}
Target: !Sub "integrations/${docsIntegration}"
# docsMapping:
# Type: AWS::ApiGatewayV2::ApiMapping
# Properties:
# DomainName: !Sub "${CustomDomainHost}.${CustomDomainZone}"
# ApiId: !Ref rootApi
# Stage: !Ref rootApilatestStage
# DependsOn: dcApi
# docsBucket:
# Type: AWS::S3::Bucket
# Properties:
# BucketName: !Sub "${CustomDomainHost}-docs.${CustomDomainZone}"
# AccessControl: PublicRead
# WebsiteConfiguration:
# IndexDocument: index.html
# ErrorDocument: index.html
# docsBucketPolicy:
# Type: AWS::S3::BucketPolicy
# Properties:
# PolicyDocument:
# Id: MyPolicy
# Version: 2012-10-17
# Statement:
# - Sid: PublicReadForGetBucketObjects
# Effect: Allow
# Principal: "*"
# Action: "s3:GetObject"
# Resource: !Sub "arn:aws:s3:::${docsBucket}/*"
# Bucket: !Ref docsBucket
# docsIntegration:
# Type: AWS::ApiGatewayV2::Integration
# Properties:
# ApiId: !Ref rootApi
# IntegrationMethod: GET
# IntegrationType: HTTP_PROXY
# IntegrationUri: !Sub "http://${docsBucket}.s3-website-us-east-1.amazonaws.com/{proxy}"
# PayloadFormatVersion: "1.0"
# docsRoute:
# Type: AWS::ApiGatewayV2::Route
# Properties:
# ApiId: !Ref rootApi
# AuthorizationType: NONE
# RouteKey: GET /docs/v2/{proxy+}
# Target: !Sub "integrations/${docsIntegration}"

0 comments on commit 78b8397

Please sign in to comment.