Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(servicecatalog): ProductStack memoryLimit prop #30105

Merged
merged 5 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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

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
Expand Up @@ -41,7 +41,7 @@
"Value": "true"
},
{
"Key": "aws-cdk:cr-owned:8a3b3620",
"Key": "aws-cdk:cr-owned:978d2e9b",
"Value": "true"
}
]
Expand Down Expand Up @@ -130,12 +130,12 @@
"Description": "/opt/awscli/aws"
}
},
"TestAssetBucketProductAssetsDeploymentCustomResource5F81E30F": {
"TestAssetBucketProductAssetsDeploymentCustomResource256MiBB5A849A6": {
"Type": "Custom::CDKBucketDeployment",
"Properties": {
"ServiceToken": {
"Fn::GetAtt": [
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536",
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiB5F7BD223",
"Arn"
]
},
Expand Down Expand Up @@ -217,7 +217,7 @@
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092"
]
},
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265": {
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleF991ED9F": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
Expand Down Expand Up @@ -248,7 +248,7 @@
]
}
},
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF": {
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleDefaultPolicyE5468F0E": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
Expand Down Expand Up @@ -327,15 +327,15 @@
],
"Version": "2012-10-17"
},
"PolicyName": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF",
"PolicyName": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleDefaultPolicyE5468F0E",
"Roles": [
{
"Ref": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265"
"Ref": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleF991ED9F"
}
]
}
},
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536": {
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiB5F7BD223": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
Expand All @@ -353,18 +353,19 @@
"Ref": "TestAssetBucketProductAssetsDeploymentAwsCliLayerD1E52C82"
}
],
"MemorySize": 256,
"Role": {
"Fn::GetAtt": [
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265",
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleF991ED9F",
"Arn"
]
},
"Runtime": "python3.9",
"Timeout": 900
},
"DependsOn": [
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF",
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265"
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleDefaultPolicyE5468F0E",
"CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C256MiBServiceRoleF991ED9F"
]
},
"Product133E85955": {
Expand Down

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.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PortfolioStack extends cdk.Stack {
cloudFormationTemplate: servicecatalog.CloudFormationTemplate.fromProductStack(
new TestAssetProductStack1(this, 'MyProductStack1', {
assetBucket: testAssetBucket,
memoryLimit: 256,
}),
),
}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ export interface ProductStackSynthesizerProps {
* @default - No KMS KeyId and SSE_KMS encryption cannot be used
*/
readonly serverSideEncryptionAwsKmsKeyId? : string;

/**
* The amount of memory (in MiB) to allocate to the AWS Lambda function which
* replicates the files from the CDK bucket to the destination bucket.
*
* If you are deploying large files, you will need to increase this number
* accordingly.
*
* @default 128
*/
readonly memoryLimit?: number;
}

/**
Expand All @@ -43,6 +54,7 @@ export class ProductStackSynthesizer extends cdk.StackSynthesizer {
private readonly assetBucket?: IBucket;
private readonly serverSideEncryption? : ServerSideEncryption;
private readonly serverSideEncryptionAwsKmsKeyId? : string;
private readonly memoryLimit?: number;
private parentAssetBucket?: IBucket;

constructor(props: ProductStackSynthesizerProps) {
Expand All @@ -51,6 +63,7 @@ export class ProductStackSynthesizer extends cdk.StackSynthesizer {
this.assetBucket = props.assetBucket;
this.serverSideEncryption = props.serverSideEncryption;
this.serverSideEncryptionAwsKmsKeyId = props.serverSideEncryptionAwsKmsKeyId;
this.memoryLimit = props.memoryLimit;

if (this.assetBucket && !cdk.Resource.isOwnedResource(this.assetBucket)) {
cdk.Annotations.of(this.parentStack).addWarningV2('@aws-cdk/aws-servicecatalog:assetsManuallyAddBucketPermissions', '[WARNING] Bucket Policy Permissions cannot be added to' +
Expand Down Expand Up @@ -90,6 +103,7 @@ export class ProductStackSynthesizer extends cdk.StackSynthesizer {
retainOnDelete: true,
serverSideEncryption: this.serverSideEncryption,
serverSideEncryptionAwsKmsKeyId: this.serverSideEncryptionAwsKmsKeyId,
memoryLimit: this.memoryLimit,
});
bucketDeployment.addSource(source);

Expand Down
Loading