-
Notifications
You must be signed in to change notification settings - Fork 59
/
template.yaml
60 lines (55 loc) · 2.2 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: "(SO8105) modify-response-header is a lambda@Edge which shows how to modify or add a response header."
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 5
Tags:
Publisher: AWS
Metadata:
AWS::ServerlessRepo::Application:
Name: modify-response-header
Description: The Lambda@Edge will modify/add response headers
Author: AWS
SpdxLicenseId: Apache-2.0
LicenseUrl: LICENSE.txt
ReadmeUrl: README.md
Labels: ['gcr','gcr-solutions','cloudfront','cloudfront+','aws-cloudfront-extensions','edge','lambda-edge', 'aws']
HomePageUrl: https://www.amazonaws.cn/en/solutions/lambda-edge-collection-for-cloudfront/
SemanticVersion: 1.0.0
SourceCodeUrl: https://github.com/awslabs/aws-cloudfront-extensions/tree/main/edge/nodejs/modify-response-header
Resources:
ModifyResponseHeaderFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: modify-response-header/
Handler: app.handler
Runtime: nodejs16.x
Role: !GetAtt EdgeFunctionRole.Arn
EdgeFunctionRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Sub ${AWS::StackName}-edgeFunction
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
- edgelambda.amazonaws.com
Action: sts:AssumeRole
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
- arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess
Outputs:
ModifyResponseHeaderFunctionARN:
Description: "ARN"
Value: !GetAtt ModifyResponseHeaderFunction.Arn
SolutionId:
Description: "Solution id"
Value: "SO8105"
ModifyResponseHeaderFunctionIamRole:
Description: "Implicit IAM Role created for Simple Lambda Edge function"
Value: !GetAtt EdgeFunctionRole.Arn