# IResource

Interface for L2 Resource constructs.

Extends: [IConstruct](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.IConstruct.html), [IEnvironmentAware](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.IEnvironmentAware.html)
Implemented by: [App](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.App.html), [Branch](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.Branch.html), [Domain](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.Domain.html), [AutoScalingConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-apprunner-alpha.AutoScalingConfiguration.html), ObservabilityConfiguration, Service, VpcConnector, VpcIngressConnection, ApiKeyCredentialProvider, BrowserCustom, BrowserCustomBase, CodeInterpreterCustom, CodeInterpreterCustomBase, Evaluator, EvaluatorBase, Gateway, GatewayBase, GatewayTarget, GatewayTargetBase, Memory, MemoryBase, OAuth2CredentialProvider, OnlineEvaluationBase, OnlineEvaluationConfig, Policy, PolicyBase, PolicyEngine, PolicyEngineBase, Runtime, RuntimeBase, RuntimeEndpoint, RuntimeEndpointBase, WorkloadIdentity, Agent, AgentAlias, AgentAliasBase, AgentBase, ApplicationInferenceProfile, Guardrail, GuardrailBase, InferenceProfileBase, KnowledgeBase, KnowledgeBaseBase, Prompt, PromptBase, Ec2Environment, GitHubRepository, Cluster, EgressOnlyInternetGateway, InternetGateway, Ipam, NatGateway, Route, RouteTable, SubnetV2, TransitGateway, TransitGatewayBlackholeRoute, TransitGatewayRoute, TransitGatewayRouteTable, TransitGatewayRouteTableAssociation, TransitGatewayRouteTablePropagation, TransitGatewayVpcAttachment, VPCPeeringConnection, VPNGatewayV2, VpcV2, VpcV2Base, IamUser, NoPasswordUser, PasswordUser, ServerlessCache, ServerlessCacheBase, UserBase, UserGroup, UserGroupBase, Alias, AliasBase, Build, BuildBase, BuildFleet, FleetBase, GameServerGroup, GameServerGroupBase, GameSessionQueue, GameSessionQueueBase, MatchmakingConfigurationBase, MatchmakingRuleSet, MatchmakingRuleSetBase, QueuedMatchmakingConfiguration, Script, ScriptBase, StandaloneMatchmakingConfiguration, Component, ContainerRecipe, ContainerRecipeBase, DistributionConfiguration, Image, ImagePipeline, ImageRecipe, InfrastructureConfiguration, LifecyclePolicy, Workflow, AccountAuditConfiguration, Logging, ScheduledAudit, TopicRule, DetectorModel, Input, Channel, PlaybackKeyPair, RecordingConfiguration, StreamKey, Application, GoFunction, PythonFunction, PythonLayerVersion, ApiKey, GeofenceCollection, Map, PlaceIndex, RouteCalculator, Tracker, Bridge, BridgeOutput, BridgeSource, Flow, FlowEntitlement, FlowOutput, FlowSource, Gateway, RouterInput, RouterNetworkInterface, RouterOutput, Channel, ChannelPlacementGroup, Cluster, Input, InputSecurityGroup, Network, SdiSource, Channel, ChannelGroup, ChannelPolicy, OriginEndpoint, OriginEndpointPolicy, Cluster, ClusterBase, ServerlessCluster, ClusterParameterGroup, DatabaseCluster, DatabaseClusterBase, DatabaseInstance, DatabaseInstanceBase, ParameterGroup, SubnetGroup, Pipe, Cluster, ClusterParameterGroup, ClusterSubnetGroup, DatabaseSecret, FirewallDomainList, FirewallRuleGroup, FirewallRuleGroupAssociation, AccessPoint, Namespace, Table, TableBucket, TableBucketPolicy, TablePolicy, Endpoint, EndpointConfig, Model, Pipeline, Application, AttributeGroup, CustomResource, Resource, ApiKey, Authorizer, BasePathMapping, CognitoUserPoolsAuthorizer, Deployment, DomainName, GatewayResponse, LambdaRestApi, Method, Model, ProxyResource, RateLimitedApiKey, RequestAuthorizer, RequestValidator, Resource, ResourceBase, RestApi, RestApiBase, SpecRestApi, Stage, StageBase, StepFunctionsRestApi, TokenAuthorizer, UsagePlan, VpcLink, ApiKey, ApiMapping, DomainName, HttpApi, HttpAuthorizer, HttpIntegration, HttpRoute, HttpStage, RateLimitedApiKey, UsagePlan, VpcLink, WebSocketApi, WebSocketAuthorizer, WebSocketIntegration, WebSocketRoute, WebSocketStage, Application, DeploymentStrategy, Environment, Extension, ScalableTarget, GatewayRoute, Mesh, Route, VirtualGateway, VirtualNode, VirtualRouter, VirtualService, ApiBase, AppsyncFunction, ChannelNamespace, EventApi, EventApiBase, GraphqlApi, GraphqlApiBase, SourceApiAssociation, AutoScalingGroup, LifecycleHook, ScheduledAction, WarmPool, BackupPlan, BackupSelection, BackupVault, ConsumableResource, EcsJobDefinition, EksJobDefinition, FairshareSchedulingPolicy, FargateComputeEnvironment, JobQueue, ManagedEc2EcsComputeEnvironment, ManagedEc2EksComputeEnvironment, MultiNodeJobDefinition, UnmanagedComputeEnvironment, ApiKeyCredentialProvider, BrowserCustom, BrowserCustomBase, CodeInterpreterCustom, CodeInterpreterCustomBase, Evaluator, EvaluatorBase, Gateway, GatewayBase, GatewayTarget, GatewayTargetBase, Memory, MemoryBase, OAuth2CredentialProvider, OnlineEvaluationBase, OnlineEvaluationConfig, Policy, PolicyBase, PolicyEngine, PolicyEngineBase, Runtime, RuntimeBase, RuntimeEndpoint, RuntimeEndpointBase, WorkloadIdentity, Certificate, DnsValidatedCertificate, PrivateCertificate, SlackChannelConfiguration, CachePolicy, CloudFrontWebDistribution, Distribution, Function, FunctionUrlOriginAccessControl, KeyGroup, KeyValueStore, MediaPackageV2OriginAccessControl, OriginAccessIdentity, OriginRequestPolicy, PublicKey, RealtimeLogConfig, ResponseHeadersPolicy, S3OriginAccessControl, VpcOrigin, EdgeFunction, Trail, Alarm, AlarmBase, AlarmMuteRule, AnomalyDetectionAlarm, CompositeAlarm, Dashboard, PromQLAlarm, BitBucketSourceCredentials, Fleet, GitHubEnterpriseSourceCredentials, GitHubSourceCredentials, PipelineProject, Project, ReportGroup, UntrustedCodeBoundaryPolicy, Repository, BaseDeploymentConfig, CustomLambdaDeploymentConfig, EcsApplication, EcsDeploymentConfig, EcsDeploymentGroup, LambdaApplication, LambdaDeploymentConfig, LambdaDeploymentGroup, ServerApplication, ServerDeploymentConfig, ServerDeploymentGroup, ProfilingGroup, Pipeline, NotificationRule, UserPool, UserPoolClient, UserPoolDomain, UserPoolGroup, UserPoolIdentityProviderAmazon, UserPoolIdentityProviderApple, UserPoolIdentityProviderFacebook, UserPoolIdentityProviderGoogle, UserPoolIdentityProviderOidc, UserPoolIdentityProviderSaml, UserPoolResourceServer, IdentityPool, AccessKeysRotated, CloudFormationStackDriftDetectionCheck, CloudFormationStackNotificationCheck, CustomPolicy, CustomRule, ManagedRule, ClusterParameterGroup, DatabaseCluster, DatabaseInstance, DatabaseSecret, Table, TableBase, TableBaseV2, TableV2, TableV2MultiAccountReplica, BastionHostLinux, ClientVpnAuthorizationRule, ClientVpnEndpoint, ClientVpnRoute, FlowLog, GatewayVpcEndpoint, Instance, InterfaceVpcEndpoint, KeyPair, LaunchTemplate, NetworkAcl, NetworkAclEntry, PlacementGroup, PrefixList, PrivateSubnet, PublicSubnet, SecurityGroup, Subnet, SubnetNetworkAclAssociation, Volume, Vpc, VpcEndpoint, VpcEndpointService, VpnConnection, VpnConnectionBase, VpnGateway, Repository, RepositoryBase, BaseService, Cluster, Ec2Service, Ec2TaskDefinition, ExternalService, ExternalTaskDefinition, FargateService, FargateTaskDefinition, TaskDefinition, AccessPoint, FileSystem, AccessEntry, Addon, Cluster, FargateCluster, Nodegroup, OidcProviderNative, OpenIdConnectProvider, AccessEntry, Addon, Cluster, FargateCluster, Nodegroup, OidcProviderNative, OpenIdConnectProvider, LoadBalancer, ApplicationListener, ApplicationLoadBalancer, BaseListener, BaseLoadBalancer, NetworkListener, NetworkLoadBalancer, TrustStore, TrustStoreRevocation, Domain, ApiDestination, Archive, Connection, EventBus, EventBusPolicy, Rule, FileSystemBase, LustreFileSystem, Accelerator, EndpointGroup, Listener, Catalog, CatalogBase, Connection, DataQualityRuleset, Database, ExternalTable, Job, JobBase, PySparkEtlJob, PySparkFlexEtlJob, PySparkStreamingJob, PythonShellJob, S3Table, ScalaSparkEtlJob, ScalaSparkFlexEtlJob, ScalaSparkStreamingJob, SecurityConfiguration, SparkJob, TableBase, Workflow, WorkflowBase, AccessKey, Group, InstanceProfile, LazyRole, ManagedPolicy, OidcProviderNative, OpenIdConnectProvider, Policy, Role, SamlProvider, User, AssessmentTemplate, ResourcePolicy, Stream, StreamConsumer, DeliveryStream, Alias, Key, Alias, CapacityProvider, CodeSigningConfig, DockerImageFunction, EventInvokeConfig, EventSourceMapping, Function, FunctionBase, FunctionUrl, LayerVersion, NetworkConnector, QualifiedFunctionBase, SingletonFunction, Version, WebFunction, WebFunctionBase, WebFunctionEndpoint, WebFunctionEndpointBase, NodejsFunction, CrossAccountDestination, LogGroup, LogStream, MetricFilter, QueryDefinition, ResourcePolicy, SubscriptionFilter, Transformer, Domain, DatabaseCluster, DatabaseClusterBase, DatabaseClusterFromSnapshot, DatabaseInstance, DatabaseInstanceBase, DatabaseInstanceFromSnapshot, DatabaseInstanceReadReplica, DatabaseProxy, DatabaseProxyEndpoint, DatabaseSecret, OptionGroup, ParameterGroup, ServerlessCluster, ServerlessClusterFromSnapshot, SubnetGroup, ARecord, AaaaRecord, CaaAmazonRecord, CaaRecord, CnameRecord, DsRecord, HealthCheck, HostedZone, HttpsRecord, KeySigningKey, MxRecord, NsRecord, PrivateHostedZone, PublicHostedZone, RecordSet, SrvRecord, SvcbRecord, TxtRecord, ZoneDelegationRecord, Bucket, BucketBase, BucketPolicy, Schedule, ScheduleGroup, ResourcePolicy, RotationSchedule, Secret, SecretTargetAttachment, CloudFormationProduct, Portfolio, Product, TagOptions, AliasTargetInstance, CnameInstance, HttpNamespace, InstanceBase, IpInstance, NonIpInstance, PrivateDnsNamespace, PublicDnsNamespace, Service, ConfigurationSet, ConfigurationSetEventDestination, DedicatedIpPool, EmailIdentity, ReceiptFilter, ReceiptRule, ReceiptRuleSet, VdmAttributes, SigningProfile, Subscription, Topic, TopicBase, TopicPolicy, Queue, QueueBase, QueuePolicy, StringListParameter, StringParameter, Activity, StateMachine, Canary, Group, AwsCliLayer, NodeProxyAgentLayer, TriggerFunction

- Source: [`core/lib/resource.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/core/lib/resource.ts#L28)
- Type last changed: v2.224.0 · 13 Nov 2025

## Properties

- `env`: [ResourceEnvironment](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  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.

- `node`: [Node](https://docs.aws.amazon.com/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `stack`: [Stack](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `applyRemovalPolicy(policy: RemovalPolicy): void` — Apply the given removal policy to this resource.

  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`).

- `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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
