Skip to content

Commit

Permalink
Add Beta redirect function
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Oct 23, 2024
1 parent 24cb906 commit 0f73967
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions spire/templates/apps/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,75 @@ Resources:
Resource: !Sub arn:${AWS::Partition}:s3:::${BetaBucket}/*
Sid: Grant read access to a CloudFront Origin Identity

RedirectFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri:
Bucket: !Ref CodeS3Bucket
Key: !Ref RedirectLambdaCodeS3ObjectKey
Description: !Sub ${EnvironmentType} Beta redirect
Environment:
Variables:
EXCHANGE_HOSTNAME: !Ref ExchangeHostname
FEEDER_HOSTNAME: !Ref FeederHostname
PLAY_HOSTNAME: !Ref PlayHostname
FunctionUrlConfig:
AuthType: NONE
Handler: index.handler
MemorySize: 128
Runtime: nodejs20.x
Tags:
prx:meta:tagging-version: "2021-04-07"
prx:cloudformation:stack-name: !Ref AWS::StackName
prx:cloudformation:stack-id: !Ref AWS::StackId
prx:cloudformation:root-stack-name: !Ref RootStackName
prx:cloudformation:root-stack-id: !Ref RootStackId
prx:ops:environment: !Ref EnvironmentType
prx:dev:application: Beta
Timeout: 8
FtpServerAuthorizerFunctionElevatedErrorAlarm:
Type: AWS::CloudWatch::Alarm
Condition: IsProduction
Properties:
AlarmName: !Sub WARN [Beta] Redirect function <${EnvironmentTypeAbbreviation}> INVOCATIONS ERRORS (${RootStackName})
AlarmDescription: !Sub >-
${EnvironmentType} Beta redirect is failing, so some traffic to the old
Beta domain may not be getting redirected to the correct place.
ComparisonOperator: GreaterThanThreshold
Dimensions:
- Name: FunctionName
Value: !Ref RedirectFunction
EvaluationPeriods: 1
MetricName: Errors
Namespace: AWS/Lambda
Period: 60
Statistic: Sum
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName }
- { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId }
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Beta }
Threshold: 0
TreatMissingData: notBreaching
RedirectFunctionLogGroup:
Type: AWS::Logs::LogGroup
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Properties:
LogGroupName: !Sub /aws/lambda/${RedirectFunction}
RetentionInDays: 14
Tags:
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }
- { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId }
- { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName }
- { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId }
- { Key: prx:ops:environment, Value: !Ref EnvironmentType }
- { Key: prx:dev:application, Value: Beta }

Outputs:
DeployBucketRegionalDomainName:
Value: !GetAtt BetaBucket.RegionalDomainName

0 comments on commit 0f73967

Please sign in to comment.