Skip to content

Commit 7954354

Browse files
authored
fix(bedrock-agentcore-alpha): runtime construct incorrectly forces default lifecycleConfiguration values (#36379)
### Issue # (if applicable) Closes #36376 ### Reason for this change The Runtime construct was incorrectly forcing default lifecycleConfiguration values even when users didn't specify them, causing unwanted lifecycle management settings to be applied and diverging from AWS Bedrock AgentCore API behavior where this configuration is completely optional. ### Description of changes Modified to only set lifecycleConfiguration when explicitly provided by users, instead of forcing default values (idleRuntimeSessionTimeout: 900, maxLifetime: 28800) ### Describe any new or updated permissions being added N/A ### Description of how you validated changes * Updated and verified all existing unit tests pass * Updated integration test snapshots that were affected by the removal of default lifecycle configuration ### 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) BREAKING CHANGE: Runtime constructs will no longer automatically include lifecycleConfiguration with default values when not explicitly specified by users. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 244c02d commit 7954354

30 files changed

Lines changed: 60 additions & 76 deletions

packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/runtime/runtime.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,14 @@ export class Runtime extends RuntimeBase {
281281
this.validateRequestHeaderConfiguration(props.requestHeaderConfiguration);
282282
}
283283

284-
this.lifecycleConfiguration = {
285-
idleRuntimeSessionTimeout: props.lifecycleConfiguration?.idleRuntimeSessionTimeout ?? LIFECYCLE_MIN_TIMEOUT,
286-
maxLifetime: props.lifecycleConfiguration?.maxLifetime ?? LIFECYCLE_MAX_LIFETIME,
287-
};
288-
this.validateLifecycleConfiguration(this.lifecycleConfiguration);
284+
this.lifecycleConfiguration = props.lifecycleConfiguration ? {
285+
idleRuntimeSessionTimeout: props.lifecycleConfiguration?.idleRuntimeSessionTimeout,
286+
maxLifetime: props.lifecycleConfiguration?.maxLifetime,
287+
} : undefined;
288+
289+
if (this.lifecycleConfiguration) {
290+
this.validateLifecycleConfiguration(this.lifecycleConfiguration);
291+
}
289292

290293
if (props.executionRole) {
291294
this.role = props.executionRole;

packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/runtime/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ export interface RequestHeaderConfiguration {
4444
export interface LifecycleConfiguration {
4545
/**
4646
* Timeout in seconds for idle runtime sessions. When a session remains idle for this duration,
47-
* it will be automatically terminated. Default: 900 seconds (15 minutes).
48-
* @default - 900 seconds (15 minutes)
47+
* it will be automatically terminated.
48+
* @default undefined - service default setting is 900 seconds (15 minutes)
4949
*/
5050
readonly idleRuntimeSessionTimeout?: Duration;
5151

5252
/**
5353
* Maximum lifetime for the instance in seconds. Once reached, instances will be automatically
54-
* terminated and replaced. Default: 28800 seconds (8 hours).
55-
* @default - 28800 seconds (8 hours)
54+
* terminated and replaced.
55+
* @default undefined - service default setting is 28800 seconds (8 hours)
5656
*/
5757
readonly maxLifetime?: Duration;
5858
}

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-cognito.js.snapshot/aws-cdk-bedrock-agentcore-runtime-cognito.assets.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-cognito.js.snapshot/aws-cdk-bedrock-agentcore-runtime-cognito.template.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,7 @@
355355
}
356356
}
357357
},
358-
"LifecycleConfiguration": {
359-
"IdleRuntimeSessionTimeout": 60,
360-
"MaxLifetime": 28800
361-
},
358+
"LifecycleConfiguration": {},
362359
"NetworkConfiguration": {
363360
"NetworkMode": "PUBLIC"
364361
},

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-cognito.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-cognito.js.snapshot/manifest.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-cognito.js.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-endpoint.js.snapshot/aws-cdk-bedrock-agentcore-runtime-endpoint.assets.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-endpoint.js.snapshot/aws-cdk-bedrock-agentcore-runtime-endpoint.template.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,7 @@
237237
},
238238
"AgentRuntimeName": "endpoint_test_runtime",
239239
"Description": "Runtime for endpoint integration test",
240-
"LifecycleConfiguration": {
241-
"IdleRuntimeSessionTimeout": 60,
242-
"MaxLifetime": 28800
243-
},
240+
"LifecycleConfiguration": {},
244241
"NetworkConfiguration": {
245242
"NetworkMode": "PUBLIC"
246243
},

packages/@aws-cdk/aws-bedrock-agentcore-alpha/test/agentcore/runtime/integ.runtime-endpoint.js.snapshot/integ.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)