mirror of
				https://github.com/eledio-cloud/standard-redirects-for-cloudfront.git
				synced 2025-10-31 00:12:56 +01:00 
			
		
		
		
	Changes for SAR
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -5,3 +5,4 @@ npm-debug.log | ||||
| *.log | ||||
| git-commit.json | ||||
| .vscode | ||||
| standard-redirects-for-cloudfront-sam.yaml | ||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							| @@ -23,6 +23,34 @@ It allows you to have very nice outward facing URLs like "/cooltopic", that inte | ||||
|  | ||||
| ## Installation | ||||
|  | ||||
| ### Installation via the Serverless Application Repository | ||||
|  | ||||
| 1. Install the application "standard-redirects-for-cloudfront". | ||||
| 2. Go to the Cloudformation Console | ||||
| 3. Select the created role and edit the trust relationship, set the policy to: | ||||
|  | ||||
|   { | ||||
|     "Version": "2012-10-17", | ||||
|     "Statement": [ | ||||
|       { | ||||
|         "Effect": "Allow", | ||||
|         "Principal": { | ||||
|           "Service": [ | ||||
|             "lambda.amazonaws.com", | ||||
|             "edgelambda.amazonaws.com" | ||||
|           ] | ||||
|         }, | ||||
|         "Action": "sts:AssumeRole" | ||||
|       } | ||||
|     ] | ||||
|   } | ||||
|  | ||||
| 4. Select the Output Value, this is the ARN (including the version) for the Lambda function. | ||||
| 5. In CloudFront edit a *Behaviour* and add a *Lambda Function Association* of type "Event Type" and enter the Lambda function ARN from the previous step. | ||||
|  | ||||
|  | ||||
| ### Manual installation | ||||
|  | ||||
| 1. Create a function called "LATE-standard-redirects-for-cloudfront" in N. Virginia (us-east-1) | ||||
| 2. Run "npm run deploy" | ||||
|  | ||||
|   | ||||
							
								
								
									
										9
									
								
								sam.yaml
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								sam.yaml
									
									
									
									
									
								
							| @@ -1,11 +1,18 @@ | ||||
| AWSTemplateFormatVersion: '2010-09-09' | ||||
| Transform: AWS::Serverless-2016-10-31 | ||||
| Outputs: | ||||
|   StandardRedirectsForCloudFrontVersionOutput: | ||||
|     Description: The ARN of the function, including the version | ||||
|     Value:  | ||||
|       Ref: DeployedFunction | ||||
|     Export: | ||||
|       Name: StandardRedirectsForCloudFrontARN | ||||
| Resources: | ||||
|   StandardRedirectsForCloudFront: | ||||
|     Type: AWS::Serverless::Function | ||||
|     Properties: | ||||
|       Handler: index.handler | ||||
|       Runtime: nodejs6.10 | ||||
|       Description: 'Standard Redirects for CloudFront by Digital Sailors via the Serverless Application Repository' | ||||
|       Description: 'Standard Redirects for CloudFront by Digital Sailors via the Serverless Application Repository.' | ||||
|       MemorySize: 128 | ||||
|       Timeout: 3 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user