Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc0e0fa
chore: Delete nodejs-upgrade-functions sample app
Apr 10, 2019
16582cd
docs: update example apps from nodejs6.10 to nodejs8.10 (#883)
carvantes Apr 10, 2019
1e8293f
chore: Delete misplaced package.json in several example apps
Apr 11, 2019
238d9b6
docs: Delete nodejs-upgrade-functions sample app (#886)
carvantes Apr 11, 2019
92decec
docs: Delete misplaced package.json in several example apps (#887)
carvantes Apr 11, 2019
d47bb52
chore: run cfn lint on translator test output (#888)
keetonian Apr 13, 2019
166304b
feat: custom CodeDeploy configurations in DeploymentPreference (#848)
Buffer0x7cd Apr 16, 2019
bd10d0e
docs: update lambda_safe_deployments example to use nodejs8.10 for th…
sullis May 2, 2019
d1aed57
chore: merge pull request #900 from awslabs/master
praneetap May 3, 2019
9ce2d88
docs: add Auth to supported Api Global properties (#899)
keetonian May 3, 2019
052c253
docs: fix typo in DEVELOPMENT_GUIDE (#902)
lestephane May 3, 2019
9385a0a
docs: update globals.rst (#905)
keetonian May 3, 2019
a7035eb
feat(policy-templates): add new policy for allowing step functions ex…
ljacobsson May 3, 2019
2ad0377
docs: add S3 filter example to docs (#909)
charliejllewellyn May 7, 2019
b0fea81
chore: bump version to 1.12.0 (#910)
keetonian May 7, 2019
71ab9b8
fix: fix Internal transform failure on bad Condition syntax (#908)
jadhavmanoj May 8, 2019
4d50d22
fix: internal transform failure on path parameters (#913)
jadhavmanoj May 17, 2019
e161046
docs: update generated_resources.rst (#919)
ingve May 17, 2019
1a7a4e6
fix: invalid event type error (#918)
praneetap May 17, 2019
e9a28a2
chore: update requirements.txt (#928)
keetonian May 20, 2019
a01fae5
chore: update base.txt (#927)
keetonian May 20, 2019
aa9c691
chore: update test_translator.py (#933)
keetonian May 24, 2019
6615433
fix: partitionalize arn in StepFunctionsExecutionPolicy (#941)
keetonian May 29, 2019
e76b939
fix: fix bug in custom DeploymentPreference feature (#966)
keetonian Jun 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DEVELOPMENT_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Install snakeviz `pip install snakeviz`

.. code-block:: shell

python -m cProfile -o sam_profile_results bin/sam-translate.py translate --input-file=tests/translator/input/alexa_skill.yaml --output-file=cfn-template.json
python -m cProfile -o sam_profile_results bin/sam-translate.py translate --template-file=tests/translator/input/alexa_skill.yaml --output-template=cfn-template.json
snakeviz sam_profile_results

Verifying transforms
Expand All @@ -96,7 +96,7 @@ If you make changes to the transformer and want to verify the resulting CloudFor

# Transform your SAM template into a CloudFormation template
# Replace "output-template.yaml" if you didn't run the package command above or specified a different path for --output-template-file
bin/sam-translate.py --input-file=output-template.yaml
bin/sam-translate.py --template-file=output-template.yaml

# Deploy your transformed CloudFormation template
# Replace MY_STACK_NAME with a unique name each time you deploy
Expand Down
2 changes: 1 addition & 1 deletion docs/cloudformation_compatibility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ AWS::Serverless::Application
================================== ======================== ========================
Location None SAM expects exact values for the Location property
Parameters All
NotificationArns All
NotificationARNs All
Tags All
TimeoutInMinutes All
================================== ======================== ========================
Expand Down
3 changes: 2 additions & 1 deletion docs/globals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Currently, the following resources and properties are being supported:
Api:
# Properties of AWS::Serverless::Api
# Also works with Implicit APIs
Auth:
Name:
DefinitionUri:
CacheClusterEnabled:
Expand All @@ -90,7 +91,7 @@ Currently, the following resources and properties are being supported:

SimpleTable:
# Properties of AWS::Serverless::SimpleTable
SSESpecification
SSESpecification:

Implicit APIs
~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/internals/generated_resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CloudFormation Resources Generated By SAM
:local:
:backlinks: none

When you create a Serverless Function or a Serverlesss API, SAM will create additional AWS resources wire everything up.
When you create a Serverless Function or a Serverlesss API, SAM will create additional AWS resources to wire everything up.
For example, when you create a ``AWS::Serverless::Function``, SAM will create a Lambda Function resource
along with an IAM Role resource to give appropriate permissions for your function. This document describes all
such generated resources, how they are named, and how to refer to them in your SAM template.
Expand Down
3 changes: 2 additions & 1 deletion docs/safe_lambda_deployments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ They work as follows:
- **AllAtOnce**: This is an instant shifting of 100% of traffic to new version. This is useful if you want to run
run pre/post hooks but don't want a gradual deployment. If you have a pipeline, you can set Beta/Gamma stages to
deploy instantly because the speed of deployments matter more than safety here.

- **Custom**: Aside from Above mentioned Configurations, Custom Codedeploy configuration are also supported.
(Example. Type: CustomCodeDeployConfiguration)

PreTraffic & PostTraffic Hooks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/website/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CommonMark==0.5.4
docutils==0.14
idna==2.6
imagesize==0.7.1
Jinja2==2.10
Jinja2>=2.10.1
MarkupSafe==1.0
Pygments==2.2.0
pytz==2017.3
Expand Down
61 changes: 29 additions & 32 deletions examples/2016-10-31/lambda_safe_deployments/src/preTrafficHook.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,44 @@
// @ts-check
'use strict';

const aws = require('aws-sdk');
const codedeploy = new aws.CodeDeploy({apiVersion: '2014-10-06'});

exports.handler = (event, context, callback) => {
exports.handler = async (event, context, callback) => {

console.log("Entering PreTraffic Hook!");
console.log(JSON.stringify(event));
//Read the DeploymentId from the event payload.
var deploymentId = event.DeploymentId;
console.log(deploymentId);
console.log("Entering PreTraffic Hook!");
console.log(JSON.stringify(event));

//Read the DeploymentId from the event payload.
let deploymentId = event.DeploymentId;
console.log("deploymentId=" + deploymentId);

//Read the LifecycleEventHookExecutionId from the event payload
var lifecycleEventHookExecutionId = event.LifecycleEventHookExecutionId;
console.log(lifecycleEventHookExecutionId);

/*
[Perform validation or prewarming steps here]
*/
// Prepare the validation test results with the deploymentId and
let lifecycleEventHookExecutionId = event.LifecycleEventHookExecutionId;
console.log("lifecycleEventHookExecutionId=" + lifecycleEventHookExecutionId);

/*
[Perform validation or prewarming steps here]
*/

// Prepare the validation test results with the deploymentId and
// the lifecycleEventHookExecutionId for AWS CodeDeploy.
var params = {
let params = {
deploymentId: deploymentId,
lifecycleEventHookExecutionId: lifecycleEventHookExecutionId,
status: 'Succeeded' // status can be 'Succeeded' or 'Failed'
};

// Pass AWS CodeDeploy the prepared validation test results.
codedeploy.putLifecycleEventHookExecutionStatus(params, function(err, data) {
if (err) {
// Validation failed.
console.log('Validation test failed');
console.log(err);
console.log(data);
callback('Validation test failed');
} else {
// Validation succeeded.
console.log('Validation test succeeded');
callback(null, 'Validation test succeeded');
}
});

try {
await codedeploy.putLifecycleEventHookExecutionStatus(params).promise();
console.log("putLifecycleEventHookExecutionStatus done. executionStatus=[" + params.status + "]");
return 'Validation test succeeded'
}
catch (err) {
console.log("putLifecycleEventHookExecutionStatus ERROR: " + err);
throw new Error('Validation test failed')
}

}

// See more: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#reference-appspec-file-structure-hooks-section-structure-lambda-sample-function
// See more: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-hooks.html#reference-appspec-file-structure-hooks-section-structure-lambda-sample-function
5 changes: 3 additions & 2 deletions examples/2016-10-31/lambda_safe_deployments/src/safeTest.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict';


exports.handler = (event, context, callback) => {
exports.handler = async (event, context, callback) => {

console.log("Function loaded! " + context.functionName + ":" + context.functionVersion);

callback(null, "Success");
}
}
6 changes: 3 additions & 3 deletions examples/2016-10-31/lambda_safe_deployments/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
Properties:
Handler: safeTest.handler
CodeUri: src/
Runtime: nodejs6.10
Runtime: nodejs8.10
AutoPublishAlias: live
DeploymentPreference:
Type: Linear10PercentEvery1Minute
Expand All @@ -35,10 +35,10 @@ Resources:
Action:
- "lambda:InvokeFunction"
Resource: !Ref safeTest.Version
Runtime: nodejs6.10
Runtime: nodejs8.10
FunctionName: 'CodeDeployHook_preTrafficHook'
DeploymentPreference:
Enabled: false
Environment:
Variables:
CurrentVersion: !Ref safeTest.Version
CurrentVersion: !Ref safeTest.Version
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ Resources:

- FilterLogEventsPolicy:
LogGroupName: name

- StepFunctionsExecutionPolicy:
StateMachineName: name
2 changes: 1 addition & 1 deletion examples/apps/alexa-skills-kit-color-expert/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs6.10
Runtime: nodejs8.10
CodeUri: .
Description: Demonstrates a basic skill built with the Amazon Alexa Skills Kit.
MemorySize: 128
Expand Down
47 changes: 47 additions & 0 deletions examples/apps/alexa-skills-kit-color-expert/testEvent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "1.0",
"session": {
"new": false,
"sessionId": "amzn1.echo-api.session.123456789012",
"application": {
"applicationId": "amzn1.ask.skill.987654321"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.testUser"
}
},
"context": {
"AudioPlayer": {
"playerActivity": "IDLE"
},
"System": {
"application": {
"applicationId": "amzn1.ask.skill.987654321"
},
"user": {
"userId": "amzn1.ask.account.testUser"
},
"device": {
"supportedInterfaces": {
"AudioPlayer": {}
}
}
}
},
"request": {
"type": "IntentRequest",
"requestId": "amzn1.echo-api.request.1234",
"timestamp": "2016-10-27T21:06:28Z",
"locale": "en-US",
"intent": {
"name": "MyColorIsIntent",
"slots": {
"Color": {
"name": "Color",
"value": "blue"
}
}
}
}
}
8 changes: 0 additions & 8 deletions examples/apps/cloudfront-ab-test/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/apps/cloudfront-ab-test/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs6.10
Runtime: nodejs8.10
CodeUri: .
Description: 'Blueprint for CloudFront ab testing, implemented in NodeJS.'
MemorySize: 128
Expand Down
36 changes: 36 additions & 0 deletions examples/apps/cloudfront-ab-test/testEvent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"Records": [
{
"cf": {
"config": {
"distributionId": "EXAMPLE"
},
"request": {
"uri": "/experiment-pixel.jpg",
"method": "GET",
"clientIp": "2001:cdba::3257:9652",
"headers": {
"user-agent": [
{
"key": "User-Agent",
"value": "Test Agent"
}
],
"host": [
{
"key": "Host",
"value": "d123.cf.net"
}
],
"cookie": [
{
"key": "Cookie",
"value": "SomeCookie=1; AnotherOne=A;"
}
]
}
}
}
}
]
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs6.10
Runtime: nodejs8.10
CodeUri: .
Description: >-
Blueprint for setting CloudFront response header based on value in the request header implemented in NodeJS.
Expand Down
42 changes: 42 additions & 0 deletions examples/apps/cloudfront-access-request-in-response/testEvent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Records": [
{
"cf": {
"config": {
"distributionId": "EXAMPLE"
},
"request": {
"headers": {
"host": [
{
"key": "Host",
"value": "d123.cf.net"
}
],
"user-name": [
{
"key": "User-Name",
"value": "CloudFront"
}
]
},
"clientIp": "2001:cdba::3257:9652",
"uri": "/test",
"method": "GET"
},
"response": {
"status": "200",
"statusDescription": "OK",
"headers": {
"x-cache": [
{
"key": "X-Cache",
"value": "Hello from Cloudfront"
}
]
}
}
}
}
]
}
8 changes: 0 additions & 8 deletions examples/apps/cloudfront-http-redirect/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/apps/cloudfront-http-redirect/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Resources:
Type: 'AWS::Serverless::Function'
Properties:
Handler: index.handler
Runtime: nodejs6.10
Runtime: nodejs8.10
CodeUri: .
Description: Blueprint for returning HTTP redirect implemented in NodeJS.
MemorySize: 128
Expand Down
8 changes: 0 additions & 8 deletions examples/apps/cloudfront-modify-querystring/package.json

This file was deleted.

Loading