Skip to content
GitHubXDiscord

View

The View resource allows you to manage AWS ResourceExplorer2 Views for searching and filtering resources in your AWS account.

Create a basic view with a name and a filter to include only EC2 instances.

import AWS from "alchemy/aws/control";
const ec2View = await AWS.ResourceExplorer2.View("ec2-view", {
ViewName: "EC2 Instances View",
Filters: {
ResourceType: "AWS::EC2::Instance"
}
});

Configure a view with additional properties, including specific scopes and included properties.

const advancedView = await AWS.ResourceExplorer2.View("advanced-view", {
ViewName: "Advanced Resource View",
Filters: {
ResourceType: "AWS::S3::Bucket"
},
Scope: "region",
IncludedProperties: ["Name", "CreationTime", "Tags"]
});

Create a view that filters resources based on specific tags.

const taggedView = await AWS.ResourceExplorer2.View("tagged-view", {
ViewName: "Tagged Resources View",
Filters: {
TagFilters: [
{
Key: "Environment",
Values: ["Production"]
}
]
},
Tags: {
Team: "DevOps"
}
});

Create a view while enabling resource adoption if a view with the same name already exists.

const adoptExistingView = await AWS.ResourceExplorer2.View("adopt-existing-view", {
ViewName: "Adopt Existing View",
Filters: {
ResourceType: "AWS::Lambda::Function"
},
adopt: true
});