Skip to content

Commit 2ff6d34

Browse files
author
Shreya
authored
chore: merge pull request #1110 from awslabs/release/v1.14.0
2 parents e7c4117 + ab6f453 commit 2ff6d34

File tree

127 files changed

+10266
-2280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+10266
-2280
lines changed

HOWTO.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ packaged template that can be readily deployed to CloudFormation.
5353
$ aws cloudformation package \
5454
--template-file /path_to_template/template.yaml \
5555
--s3-bucket bucket-name \
56-
--s3-prefix appname/branchname/version
56+
--s3-prefix appname/branchname/version \
5757
--output-template-file packaged-template.yaml
5858
```
5959

@@ -63,7 +63,7 @@ Or using the aws-sam-cli
6363
$ sam package \
6464
--template-file /path_to_template/template.yaml \
6565
--s3-bucket bucket-name \
66-
--s3-prefix appname/branchname/version
66+
--s3-prefix appname/branchname/version \
6767
--output-template-file packaged-template.yaml
6868
```
6969

@@ -104,7 +104,7 @@ Or using aws-sam-cli
104104
```bash
105105
$ sam deploy \
106106
--template-file /path_to_template/packaged-template.yaml \
107-
--stack-name my-new-stack
107+
--stack-name my-new-stack \
108108
--capabilities CAPABILITY_IAM
109109
```
110110

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

docs/cloudformation_compatibility.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ Schedule
125125
======================== ================================== ========================
126126
Schedule All
127127
Input All
128+
Name All
129+
Description All
130+
Enabled All
128131
======================== ================================== ========================
129132

130133
CloudWatchEvent

docs/safe_lambda_deployments.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ resource:
9393
Type: AWS::Serverless::Function
9494
Properties:
9595
Handler: index.handler
96-
Runtime: nodejs6.10
96+
Runtime: nodejs8.10
9797
AutoPublishAlias: live
9898
DeploymentPreference:
9999
Type: Linear10PercentEvery10Minutes
@@ -162,8 +162,8 @@ resource:
162162
- Effect: "Allow"
163163
Action:
164164
- "lambda:InvokeFunction"
165-
Resource: !Ref MyLambdaFunction.Version
166-
Runtime: nodejs6.10
165+
Resource: !GetAtt MyLambdaFunction.Arn
166+
Runtime: nodejs8.10
167167
FunctionName: 'CodeDeployHook_preTrafficHook'
168168
DeploymentPreference:
169169
Enabled: false
@@ -286,7 +286,7 @@ Hooks are extremely powerful because:
286286
- Effect: "Allow"
287287
Action:
288288
- "lambda:InvokeFunction"
289-
Resource: !Ref MyLambdaFunction.Version
289+
Resource: !GetAtt MyLambdaFunction.Arn
290290
291291
Checkout the lambda_safe_deployments_ folder for an example for how to create SAM template that contains a hook function.
292292

examples/2016-10-31/api_aws_iam_auth/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Resources:
88
StageName: Prod
99
Auth:
1010
DefaultAuthorizer: AWS_IAM
11-
InvokeRole: CALLER_CREDENTIALS
11+
InvokeRole: CALLER_CREDENTIALS # default, can specify other role or NONE
1212

1313
MyFunction:
1414
Type: AWS::Serverless::Function

examples/2016-10-31/api_cognito_auth/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"configure-cognito-user-pool": "npm run set-cognito-user-pool-id && npm run set-cognito-user-pool-client-id && npm run set-api-id && npm run set-api-url && npm run update-user-pool-client && npm run create-user-pool-domain",
2020
"set-cognito-user-pool-id": "npm config set COGNITO_USER_POOL_ID $(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`CognitoUserPoolId`].OutputValue' --output text)",
2121
"set-cognito-user-pool-client-id": "npm config set COGNITO_USER_POOL_CLIENT_ID $(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`CognitoUserPoolClientId`].OutputValue' --output text)",
22-
"set-api-url": "npm config set API_URL $(aws cloudformation describe-stacks --stack-name sam-example-api-cognito-auth --query 'Stacks[].Outputs[?OutputKey==`ApiUrl`].OutputValue' --output text)",
23-
"set-api-id": "npm config set API_ID $(aws cloudformation describe-stacks --stack-name sam-example-api-cognito-auth --query 'Stacks[].Outputs[?OutputKey==`ApiId`].OutputValue' --output text)",
22+
"set-api-url": "npm config set API_URL $(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`ApiUrl`].OutputValue' --output text)",
23+
"set-api-id": "npm config set API_ID $(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`ApiId`].OutputValue' --output text)",
2424
"update-user-pool-client": "aws cognito-idp update-user-pool-client --user-pool-id $(npm config get COGNITO_USER_POOL_ID) --client-id $(npm config get COGNITO_USER_POOL_CLIENT_ID) --supported-identity-providers COGNITO --callback-urls \"[\\\"$(npm config get API_URL)\\\"]\" --allowed-o-auth-flows code implicit --allowed-o-auth-scopes openid email --allowed-o-auth-flows-user-pool-client",
2525
"create-user-pool-domain": "aws cognito-idp create-user-pool-domain --domain $(npm config get API_ID) --user-pool-id $(npm config get COGNITO_USER_POOL_ID)",
26-
"open-signup-page": "open \"https://$(npm config get API_ID).auth.us-east-1.amazoncognito.com/signup?response_type=code&client_id=$(npm config get COGNITO_USER_POOL_CLIENT_ID)&redirect_uri=$(npm config get API_URL)\"",
27-
"open-login-page": "open \"https://$(npm config get API_ID).auth.us-east-1.amazoncognito.com/login?response_type=code&client_id=$(npm config get COGNITO_USER_POOL_CLIENT_ID)&redirect_uri=$(npm config get API_URL)\"",
26+
"open-signup-page": "open \"https://$(npm config get API_ID).auth.$(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`Region`].OutputValue' --output text).amazoncognito.com/signup?response_type=code&client_id=$(npm config get COGNITO_USER_POOL_CLIENT_ID)&redirect_uri=$(npm config get API_URL)\"",
27+
"open-login-page": "open \"https://$(npm config get API_ID).auth.$(aws cloudformation describe-stacks --stack-name $(npm config get STACK_NAME) --query 'Stacks[].Outputs[?OutputKey==`Region`].OutputValue' --output text).amazoncognito.com/login?response_type=code&client_id=$(npm config get COGNITO_USER_POOL_CLIENT_ID)&redirect_uri=$(npm config get API_URL)\"",
2828
"open-api-ui": "open \"$(npm config get API_URL)\""
2929
}
3030
}

examples/2016-10-31/api_cognito_auth/template.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ Resources:
140140
# UserPool: !Ref MyCognitoUserPool
141141

142142
Outputs:
143+
Region:
144+
Description: "Region"
145+
Value: !Ref AWS::Region
146+
143147
ApiId:
144148
Description: "API ID"
145149
Value: !Ref MyApi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Api Resource Policy Event Source Example
2+
3+
Example SAM template for adding Custom Resource Policy to Api.
4+
5+
## Running the example
6+
7+
```bash
8+
# Replace YOUR_S3_ARTIFACTS_BUCKET
9+
aws cloudformation package --template-file template.yaml --output-template-file cfn-transformed-template.yaml --s3-bucket YOUR_S3_ARTIFACTS_BUCKET
10+
aws cloudformation deploy --template-file ./cfn-transformed-template.yaml --stack-name example-resource-policy --capabilities CAPABILITY_IAM
11+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Transform: AWS::Serverless-2016-10-31
3+
Globals:
4+
Api:
5+
Auth:
6+
ResourcePolicy:
7+
CustomStatements: [{
8+
"Effect": "Allow",
9+
"Principal": "*",
10+
"Action": "execute-api:Invoke",
11+
"Resource": "execute-api:*/*/*",
12+
"Condition": {
13+
"IpAddress": {
14+
"aws:SourceIp": "1.2.3.4"
15+
}
16+
}
17+
}]
18+
Resources:
19+
MyFunction:
20+
Type: AWS::Serverless::Function
21+
Properties:
22+
InlineCode: |
23+
exports.handler = async (event) => {
24+
const response = {
25+
statusCode: 200,
26+
body: JSON.stringify('Hello from Lambda!'),
27+
};
28+
return response;
29+
};
30+
Handler: index.handler
31+
Runtime: nodejs8.10
32+
Events:
33+
Api:
34+
Type: Api
35+
Properties:
36+
Method: Put
37+
Path: /get

examples/2016-10-31/lambda_safe_deployments/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Resources:
3434
- Effect: "Allow"
3535
Action:
3636
- "lambda:InvokeFunction"
37-
Resource: !Ref safeTest.Version
37+
Resource: !GetAtt safeTest.Arn
3838
Runtime: nodejs8.10
3939
FunctionName: 'CodeDeployHook_preTrafficHook'
4040
DeploymentPreference:

0 commit comments

Comments
 (0)