App
The App resource lets you manage AWS ResilienceHub Apps for assessing and improving the resiliency of your applications.
Minimal Example
Section titled “Minimal Example”Create a basic ResilienceHub app with essential properties.
import AWS from "alchemy/aws/control";
const resilienceHubApp = await AWS.ResilienceHub.App("basicApp", { name: "MyResilienceApp", appTemplateBody: JSON.stringify({ version: "1.0", resources: [] }), resourceMappings: [ { resourceName: "MyEC2Instance", resourceType: "AWS::EC2::Instance" } ], description: "This is a minimal ResilienceHub app."});
Advanced Configuration
Section titled “Advanced Configuration”Configure a ResilienceHub app with an assessment schedule and event subscriptions.
const advancedResilienceHubApp = await AWS.ResilienceHub.App("advancedApp", { name: "AdvancedResilienceApp", appTemplateBody: JSON.stringify({ version: "1.0", resources: [] }), resourceMappings: [ { resourceName: "MyDynamoDBTable", resourceType: "AWS::DynamoDB::Table" } ], appAssessmentSchedule: "rate(1 day)", eventSubscriptions: [ { event: "Creation", target: "arn:aws:sns:us-west-2:123456789012:MySNSTopic" } ], tags: { Environment: "Production", Team: "DevOps" }});
Adoption of Existing Resources
Section titled “Adoption of Existing Resources”Create a ResilienceHub app that adopts existing resources without failure if they already exist.
const adoptExistingApp = await AWS.ResilienceHub.App("adoptApp", { name: "AdoptExistingApp", appTemplateBody: JSON.stringify({ version: "1.0", resources: [] }), resourceMappings: [ { resourceName: "MyS3Bucket", resourceType: "AWS::S3::Bucket" } ], adopt: true // Adopt existing resources if they exist});
Resiliency Policy Association
Section titled “Resiliency Policy Association”Set a Resiliency Policy ARN while creating the app to ensure compliance with defined policies.
const policyAssociatedApp = await AWS.ResilienceHub.App("policyApp", { name: "PolicyAssociatedApp", appTemplateBody: JSON.stringify({ version: "1.0", resources: [] }), resourceMappings: [ { resourceName: "MyLambdaFunction", resourceType: "AWS::Lambda::Function" } ], resiliencyPolicyArn: "arn:aws:resiliencehub:us-west-2:123456789012:policy/MyResiliencyPolicy"});