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.
Minimal Example
Section titled “Minimal Example”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"});
Advanced Configuration
Section titled “Advanced Configuration”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});
Handling Resource Updates
Section titled “Handling Resource Updates”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" } ]});
Deleting a ProfileAssociation
Section titled “Deleting a ProfileAssociation”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});