Bugfixes for automated version creation

This commit is contained in:
Oliver Gutperl
2019-03-28 17:42:28 +01:00
parent 9293626aa5
commit 5872e8e1a7
4 changed files with 14 additions and 11 deletions

3
.gitignore vendored
View File

@@ -5,4 +5,5 @@ npm-debug.log
*.log
git-commit.json
.vscode
standard-redirects-for-cloudfront-sam.yaml
standard-redirects-for-cloudfront-sam.yaml
standard-redirects-for-cloudfront-sam-test.yaml

View File

@@ -24,6 +24,14 @@ It allows you to have very nice outward facing URLs like "/cooltopic", that inte
Make sure that your CloudFront distribution handles the URL "/" directly by having the property "Default Root Object" set to "index.html".
## Updating
1. Install the application "standard-redirects-for-cloudfront".
2. Go to the Cloudformation Console
3. Select the Output Value, this is the ARN (including the version) for the Lambda function.
4. In CloudFront edit a **Behaviour** and add a **Lambda Function Association** with the *Event Type* "Origin Request" and enter the Lambda function ARN from the previous step.
5. Wait for the CloudFront distribution to deploy.
## Installation
### Installation via the Serverless Application Repository

View File

@@ -1,6 +1,6 @@
{
"name": "standard-redirects-for-cloudfront",
"version": "1.2.0",
"version": "1.3.1",
"description": "",
"main": "index.js",
"scripts": {
@@ -8,7 +8,8 @@
"test-coverage": "istanbul cover _mocha",
"predeploy": "git log -1 --pretty=format:'{ \"date\":\"%cI\", \"commit\":\"%H\" }' > git-commit.json",
"deploy": "zip -r LATE-standard-redirects-for-cloudfront.zip . -i \\*.js -i git-commit.json -i node_modules/\\* -x test/\\* -x node_modules/aws-sdk/\\* -x node_modules/mocha/\\* && echo Uploading... && aws lambda update-function-code --region us-east-1 --function-name LATE-standard-redirects-for-cloudfront --zip-file fileb://LATE-standard-redirects-for-cloudfront.zip --publish",
"package": "aws cloudformation package --template-file sam.yaml --output-template-file standard-redirects-for-cloudfront-sam.yaml --s3-bucket public.digital-sailors.de --s3-prefix serverless-application-repo/standard-redirects-for-cloudfront"
"package": "aws cloudformation package --template-file sam.yaml --output-template-file standard-redirects-for-cloudfront-sam.yaml --s3-bucket public.digital-sailors.de --s3-prefix serverless-application-repo/standard-redirects-for-cloudfront",
"package-test": "aws cloudformation package --template-file sam.yaml --output-template-file standard-redirects-for-cloudfront-sam-test.yaml --s3-bucket demo.digital-sailors.work --s3-prefix serverless-application-repo/standard-redirects-for-cloudfront-test"
},
"dependencies": {},
"license": "Apache-2.0",

View File

@@ -3,8 +3,7 @@ Transform: AWS::Serverless-2016-10-31
Outputs:
StandardRedirectsForCloudFrontVersionOutput:
Description: The ARN of the function, including the version
Value:
Ref: DeployedFunction
Value: !Ref StandardRedirectsForCloudFront.Version
Export:
Name: StandardRedirectsForCloudFrontARN
Resources:
@@ -17,9 +16,3 @@ Resources:
MemorySize: 128
Timeout: 3
AutoPublishAlias: 'CurrentProd'
DeployedFunction:
Type: AWS::Lambda::Version
Properties:
Description: The deployed version of the function
FunctionName:
Ref: StandardRedirectsForCloudFront