Skip to content
GitHubXDiscord

ProfileAssociation

The ProfileAssociation resource allows you to associate a resource with a profile in AWS Route53Profiles. This is essential for managing resources in a controlled manner, ensuring that they adhere to the policies and settings defined in the associated profile. For more information, refer to the AWS Route53Profiles ProfileAssociations documentation.

Create a basic ProfileAssociation linking a resource to a profile:

import AWS from "alchemy/aws/control";
const profileAssociation = await AWS.Route53Profiles.ProfileAssociation("basicProfileAssociation", {
ProfileId: "profile-12345",
ResourceId: "resource-67890",
Name: "MyProfileAssociation"
});

Configure a ProfileAssociation with tags and the option to adopt an existing resource:

const advancedProfileAssociation = await AWS.Route53Profiles.ProfileAssociation("advancedProfileAssociation", {
ProfileId: "profile-12345",
ResourceId: "resource-67890",
Name: "AdvancedProfileAssociation",
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Owner", Value: "DevTeam" }
],
adopt: true
});

Update an existing ProfileAssociation by changing its name and tags:

const updatedProfileAssociation = await AWS.Route53Profiles.ProfileAssociation("updatedProfileAssociation", {
ProfileId: "profile-12345",
ResourceId: "resource-67890",
Name: "UpdatedProfileAssociation",
Tags: [
{ Key: "Environment", Value: "Staging" },
{ Key: "Owner", Value: "QA Team" }
]
});

Remove a ProfileAssociation when it’s no longer needed:

const deleteProfileAssociation = await AWS.Route53Profiles.ProfileAssociation("deleteProfileAssociation", {
ProfileId: "profile-12345",
ResourceId: "resource-67890",
Name: "DeleteProfileAssociation",
adopt: false // Ensure this does not fail if resource is absent
});