Skip to content
v2.273.0

BrowserCustom L2 construct ​

Browser resource for AWS Bedrock Agent Core.

Provides a browser environment for web automation and interaction.

Example ​

ts
const browser = new agentcore.BrowserCustom(this, 'BrowserVpcWithRecording', {
  browserCustomName: 'browser_recording',
  networkConfiguration: agentcore.BrowserNetworkConfiguration.usingVpc(this, {
    vpc: new ec2.Vpc(this, 'VPC', { restrictDefaultSecurityGroup: false }),
  }),
});
python
browser = agentcore.BrowserCustom(self, "BrowserVpcWithRecording",
    browser_custom_name="browser_recording",
    network_configuration=agentcore.BrowserNetworkConfiguration.using_vpc(self,
        vpc=ec2.Vpc(self, "VPC", restrict_default_security_group=False)
    )
)
java
BrowserCustom browser = BrowserCustom.Builder.create(this, "BrowserVpcWithRecording")
        .browserCustomName("browser_recording")
        .networkConfiguration(BrowserNetworkConfiguration.usingVpc(this, VpcConfigProps.builder()
                .vpc(Vpc.Builder.create(this, "VPC").restrictDefaultSecurityGroup(false).build())
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
var browser = new BrowserCustom(this, "BrowserVpcWithRecording", new BrowserCustomProps {
    BrowserCustomName = "browser_recording",
    NetworkConfiguration = BrowserNetworkConfiguration.UsingVpc(this, new VpcConfigProps {
        Vpc = new Vpc(this, "VPC", new VpcProps { RestrictDefaultSecurityGroup = false })
    })
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
browser := agentcore.NewBrowserCustom(this, jsii.String("BrowserVpcWithRecording"), &BrowserCustomProps{
	BrowserCustomName: jsii.String("browser_recording"),
	NetworkConfiguration: agentcore.BrowserNetworkConfiguration_UsingVpc(this, &VpcConfigProps{
		Vpc: ec2.NewVpc(this, jsii.String("VPC"), &VpcProps{
			RestrictDefaultSecurityGroup: jsii.Boolean(false),
		}),
	}),
})

Initializer ​

ts
new BrowserCustom(scope: Construct, id: string, props?: BrowserCustomProps)
python
BrowserCustom(scope: Construct, id: str, props: typing.Optional[BrowserCustomProps] = None)
java
new BrowserCustom(Construct scope, String id, BrowserCustomProps props)
csharp
new BrowserCustom(Construct scope, string id, BrowserCustomProps? props = null)
go
NewBrowserCustom(Scope Construct, Id *string, Props BrowserCustomProps)

Construct Props ​

browserCustomNamestringbrowser_custom_namestrbrowserCustomNameStringBrowserCustomNamestringBrowserCustomName*string= auto generate#
The name of the browser custom tool Valid characters are a-z, A-Z, 0-9, _ (underscore) The name must start with a letter and can be up to 48 characters long Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}.
browserSigningBrowserSigningbrowser_signingBrowserSigningbrowserSigningBrowserSigningBrowserSigningBrowserSigningBrowserSigningBrowserSigning= BrowserSigning.DISABLED#
Specifies whether browser signing is enabled.

When enabled, the browser will cryptographically sign HTTP requests to identify itself as an AI agent to bot control vendors.

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description#
Optional description for the browser Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces The description can have up to 200 characters.
executionRoleIRoleexecution_roleIRoleexecutionRoleIRoleExecutionRoleIRoleExecutionRoleIRole= A new role will be created#
The IAM role that provides permissions for the browser to access AWS services.
networkConfigurationBrowserNetworkConfigurationnetwork_configurationBrowserNetworkConfigurationnetworkConfigurationBrowserNetworkConfigurationNetworkConfigurationBrowserNetworkConfigurationNetworkConfigurationBrowserNetworkConfiguration= PUBLIC network mode#
Network configuration for browser.
recordingConfigRecordingConfigrecording_configRecordingConfigrecordingConfigRecordingConfigRecordingConfigRecordingConfigRecordingConfigRecordingConfig= No recording configuration#
Recording configuration for browser.
tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string= {} - no tags#
Tags (optional) A list of key:value pairs of tags to apply to this Browser resource.

Properties ​

browserArnstringbrowser_arnstrbrowserArnStringBrowserArnstringBrowserArn*stringrequired#
The ARN of the browser resource.
browserCustomNamestringbrowser_custom_namestrbrowserCustomNameStringBrowserCustomNamestringBrowserCustomName*stringrequired#
The name of the browser custom tool.
browserCustomRefBrowserCustomReferencebrowser_custom_refBrowserCustomReferencebrowserCustomRefBrowserCustomReferenceBrowserCustomRefBrowserCustomReferenceBrowserCustomRefBrowserCustomReferencerequired#
A reference to a BrowserCustom resource.
browserIdstringbrowser_idstrbrowserIdStringBrowserIdstringBrowserId*stringrequired#
The id of the browser.
browserSigningBrowserSigningbrowser_signingBrowserSigningbrowserSigningBrowserSigningBrowserSigningBrowserSigningBrowserSigningBrowserSigning#
The browser signing configuration of the browser.
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
An accessor for the Connections object that will fail if this Browser does not have a VPC configured.
createdAtstringcreated_atstrcreatedAtStringCreatedAtstringCreatedAt*string#
The created timestamp of the browser.
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string#
The description of the browser.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

executionRoleIRoleexecution_roleIRoleexecutionRoleIRoleExecutionRoleIRoleExecutionRoleIRolerequired#
The IAM role associated to the browser.
failureReasonstringfailure_reasonstrfailureReasonStringFailureReasonstringFailureReason*string#
The failure reason of the browser.
grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipalrequired#
The principal to grant permissions to.
lastUpdatedAtstringlast_updated_atstrlastUpdatedAtStringLastUpdatedAtstringLastUpdatedAt*string#
The last updated timestamp of the browser.
networkConfigurationBrowserNetworkConfigurationnetwork_configurationBrowserNetworkConfigurationnetworkConfigurationBrowserNetworkConfigurationNetworkConfigurationBrowserNetworkConfigurationNetworkConfigurationBrowserNetworkConfigurationrequired#
The network configuration of the browser.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#
Uniquely identifies this class.
recordingConfigRecordingConfigrecording_configRecordingConfigrecordingConfigRecordingConfigRecordingConfigRecordingConfigRecordingConfigRecordingConfig#
The recording configuration of the browser.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
statusstringstatusstrstatusStringStatusstringStatus*string#
The status of the browser.
tags{ [key: string]: string }tagstyping.Mapping[str, str]tagsMap<String, String>TagsIDictionary<string, string>Tags*map[string]*string= No tags applied#
Tags applied to this browser resource A map of key-value pairs for resource tagging.

Methods ​

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Override the cross-stack reference strength for this resource.
notes · 1 parameter

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

fromBrowserCustomAttributes(scope: Construct, id: string, attrs: BrowserCustomAttributes): IBrowserCustom@staticmethod def from_browser_custom_attributes(scope: Construct, id: str, attrs: BrowserCustomAttributes) -> IBrowserCustompublic static IBrowserCustom fromBrowserCustomAttributes(Construct scope, String id, BrowserCustomAttributes attrs)public static IBrowserCustom FromBrowserCustomAttributes(Construct scope, string id, BrowserCustomAttributes attrs)func FromBrowserCustomAttributes(Scope Construct, Id *string, Attrs BrowserCustomAttributes) IBrowserCustomstatic#
Creates an Browser Custom reference from an existing browser's attributes.
3 parameters · returns

Parameters

  • scopescopescopescopeScope — - The construct scope.
  • ididididId — - Identifier of the construct.
  • attrsattrsattrsattrsAttrs — - Attributes of the existing browser custom.

Returns: An IBrowserCustom reference to the existing browser

grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#
Grants IAM actions to the IAM Principal.

[disable-awslint:no-grants]

2 parameters · returns

Parameters

  • granteegranteegranteegranteeGrantee — - The IAM principal to grant permissions to.
  • actionsactionsactionsactionsActions — - The actions to grant.

Returns: An IAM Grant object representing the granted permissions

grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#
Grant read permissions on this browser to an IAM principal.

This includes both read permissions on the specific browser and list permissions on all browsers.

[disable-awslint:no-grants]

1 parameter · returns

Parameters

  • granteegranteegranteegranteeGrantee — - The IAM principal to grant read permissions to.

Returns: An IAM Grant object representing the granted permissions

grantUse(grantee: IGrantable): Grantdef grant_use(self, grantee: IGrantable) -> Grantpublic Grant grantUse(IGrantable grantee)public Grant GrantUse(IGrantable grantee)func GrantUse(Grantee IGrantable) Grant#
Grant permissions to use this browser to an IAM principal.
notes · 1 parameter · returns

This includes ConnectBrowserAutomationStream, which is required to connect to the automation stream of a session over the Chrome DevTools Protocol. Without it, StartBrowserSession succeeds but the subsequent connection to the returned stream endpoint is rejected.

[disable-awslint:no-grants]

Parameters

  • granteegranteegranteegranteeGrantee — - The IAM principal to grant use permissions to.

Returns: An IAM Grant object representing the granted permissions

isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#
Returns true if the construct was created by CDK, and false otherwise.
isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#
Check whether the given construct is a Resource.
metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
Return the given named metric for this browser.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_errors_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricErrorsForApiOperation(String operation, MetricOptions props)public Metric MetricErrorsForApiOperation(string operation, MetricOptions? props = null)func MetricErrorsForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser errors.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser errors

metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metricdef metric_for_api_operation(self, metric_name: str, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricForApiOperation(String metricName, String operation, MetricOptions props)public Metric MetricForApiOperation(string metricName, string operation, MetricOptions? props = null)func MetricForApiOperation(MetricName *string, Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser api operations..
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser api operations

metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_invocations_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricInvocationsForApiOperation(String operation, MetricOptions props)public Metric MetricInvocationsForApiOperation(string operation, MetricOptions? props = null)func MetricInvocationsForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser invocations.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser latencies

metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_latency_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricLatencyForApiOperation(String operation, MetricOptions props)public Metric MetricLatencyForApiOperation(string operation, MetricOptions? props = null)func MetricLatencyForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser latencies.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser latencies

metricSessionDuration(props?: MetricOptions): Metricdef metric_session_duration(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricSessionDuration(MetricOptions props)public Metric MetricSessionDuration(MetricOptions? props = null)func MetricSessionDuration(Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser session duration.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser session duration

metricSystemErrorsForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_system_errors_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricSystemErrorsForApiOperation(String operation, MetricOptions props)public Metric MetricSystemErrorsForApiOperation(string operation, MetricOptions? props = null)func MetricSystemErrorsForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser system errors.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser system errors

metricTakeOverCount(props?: MetricOptions): Metricdef metric_take_over_count(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTakeOverCount(MetricOptions props)public Metric MetricTakeOverCount(MetricOptions? props = null)func MetricTakeOverCount(Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser user takeovers.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser user takeovers

metricTakeOverDuration(props?: MetricOptions): Metricdef metric_take_over_duration(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTakeOverDuration(MetricOptions props)public Metric MetricTakeOverDuration(MetricOptions? props = null)func MetricTakeOverDuration(Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser user takeovers duration.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser user takeovers duration

metricTakeOverReleaseCount(props?: MetricOptions): Metricdef metric_take_over_release_count(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricTakeOverReleaseCount(MetricOptions props)public Metric MetricTakeOverReleaseCount(MetricOptions? props = null)func MetricTakeOverReleaseCount(Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser user takeovers released.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser user takeovers released

metricThrottlesForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_throttles_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricThrottlesForApiOperation(String operation, MetricOptions props)public Metric MetricThrottlesForApiOperation(string operation, MetricOptions? props = null)func MetricThrottlesForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser throttles.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser throttles

metricUserErrorsForApiOperation(operation: string, props?: MetricOptions): Metricdef metric_user_errors_for_api_operation(self, operation: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricUserErrorsForApiOperation(String operation, MetricOptions props)public Metric MetricUserErrorsForApiOperation(string operation, MetricOptions? props = null)func MetricUserErrorsForApiOperation(Operation *string, Props MetricOptions) Metric#
Creates a CloudWatch metric for tracking browser user errors.
1 parameter · returns

Parameters

  • propspropspropspropsProps — - Configuration options for the metric.

Returns: A CloudWatch Metric configured for browser user errors

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.