-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
### Issue # (if applicable) Closes #29891 ### Reason for this change When setting AwsCustomResource with installLatestAwsSdk: true it fails to upgrade aws-sdk to latest version. The Lambda function created to support the custom resource usually time out after 120 seconds, and for some cases it get time out even after 900 seconds. ### Description of changes Update the Lambda function created for the custom resource to set its MemorySize to be 512 in case if installLatestAwsSdk flag is true instead of the default value 128. Also, this change will expose the MemorySize to the AwsCustomResource construct, so customers can customize the MemorySize of the Lambda function to fulfill use cases that requires higher memory, CPU, or I/O performance. ### Description of how you validated changes I added the unit test cases, and updated the integration test cases. ### Checklist - [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
{ | ||
"Resources": { | ||
"myTableA48C5C70": { | ||
"Type": "AWS::DynamoDB::Table", | ||
"Properties": { | ||
"AttributeDefinitions": [ | ||
{ | ||
"AttributeName": "id", | ||
"AttributeType": "S" | ||
} | ||
], | ||
"KeySchema": [ | ||
{ | ||
"AttributeName": "id", | ||
"KeyType": "HASH" | ||
} | ||
], | ||
"ProvisionedThroughput": { | ||
"ReadCapacityUnits": 5, | ||
"WriteCapacityUnits": 5 | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"myCRE89CE839": { | ||
"Type": "Custom::AWS", | ||
"Properties": { | ||
"ServiceToken": { | ||
"Fn::GetAtt": [ | ||
"AWS679f53fac002430cb0da5b7982bd22872D164C4C", | ||
"Arn" | ||
] | ||
}, | ||
"Create": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"service\":\"DynamoDB\",\"action\":\"PutItem\",\"parameters\":{\"Item\":{\"id\":{\"S\":\"test-value\"}},\"TableName\":\"", | ||
{ | ||
"Ref": "myTableA48C5C70" | ||
}, | ||
"\"},\"physicalResourceId\":{\"id\":\"myCRphysicalResourceID\"},\"logApiResponseData\":true}" | ||
] | ||
] | ||
}, | ||
"Update": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\"service\":\"DynamoDB\",\"action\":\"PutItem\",\"parameters\":{\"service\":\"DynamoDB\",\"action\":\"PutItem\",\"parameters\":{\"Item\":{\"id\":{\"S\":\"test-value\"}},\"TableName\":\"", | ||
{ | ||
"Ref": "myTableA48C5C70" | ||
}, | ||
"\"},\"physicalResourceId\":{\"id\":\"myCRphysicalResourceID\"}},\"logApiResponseData\":true}" | ||
] | ||
] | ||
}, | ||
"InstallLatestAwsSdk": true | ||
}, | ||
"DependsOn": [ | ||
"myCRCustomResourcePolicy05AD5A90" | ||
], | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"myCRCustomResourcePolicy05AD5A90": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "dynamodb:PutItem", | ||
"Effect": "Allow", | ||
"Resource": "*" | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "myCRCustomResourcePolicy05AD5A90", | ||
"Roles": [ | ||
{ | ||
"Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" | ||
} | ||
] | ||
} | ||
}, | ||
"AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:", | ||
{ | ||
"Ref": "AWS::Partition" | ||
}, | ||
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
] | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"AWS679f53fac002430cb0da5b7982bd22872D164C4C": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"S3Bucket": { | ||
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" | ||
}, | ||
"S3Key": "746da84b10e215c552e68b6d2061024e4429f0386f43a35ef5e4d2940655692e.zip" | ||
}, | ||
"Handler": "index.handler", | ||
"MemorySize": 1024, | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "nodejs18.x", | ||
"Timeout": 120 | ||
}, | ||
"DependsOn": [ | ||
"AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.