### AutoVer Tool Installation Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/CONTRIBUTING.md Command to install the AutoVer tool globally. ```bash dotnet tool install -g AutoVer ``` -------------------------------- ### Handle AWSProvisioningException Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example of catching and logging provisioning errors during application startup. ```csharp try { var app = builder.Build(); await app.RunAsync(); } catch (AWSProvisioningException ex) { logger.LogError(ex, "Failed to provision AWS resources: {Message}", ex.Message); throw; } ``` -------------------------------- ### Install Aspire.Hosting.AWS package Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Use the .NET CLI to add the required NuGet package to your AppHost project. ```dotnetcli dotnet add package Aspire.Hosting.AWS ``` -------------------------------- ### Install AgentCore Hosting Package Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Add the required NuGet package to your agent project. ```bash dotnet add package AWS.AgentCore.Hosting ``` -------------------------------- ### Implement ConstructOutputDelegates Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example implementations for extracting properties from Bucket and Table constructs. ```csharp ConstructOutputDelegate bucketNameOutput = bucket => bucket.BucketName; ConstructOutputDelegate tableNameOutput = table => table.TableName; ``` -------------------------------- ### Change File Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/CONTRIBUTING.md An example of the JSON structure for a change file used to document contributions. ```json { "Projects": [ { "Name": "Aspire.Hosting.AWS", "Type": "Patch", "ChangelogMessages": [ "Fixed an issue causing a failure somewhere" ] } ] } ``` -------------------------------- ### AddS3Bucket Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/s3-extensions.md Demonstrates adding S3 buckets with custom properties and default settings to a CDK stack. ```csharp var stack = builder.AddAWSCDKStack("storage"); var dataLake = stack.AddS3Bucket("data-lake", new BucketProps { Versioned = true, BlockPublicAccess = BlockPublicAccess.BlockAll(), LifecycleRules = new[] { new LifecycleRule { Transitions = new[] { new Transition { StorageClass = StorageClass.INTELLIGENT_TIERING, TransitionAfter = Duration.Days(30) } } } } }); var publicAssets = stack.AddS3Bucket("public-assets"); ``` -------------------------------- ### Add a Construct Resource Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example of adding a construct resource to a stack. ```csharp IResourceBuilder> tableResource = stack.AddConstruct("users", scope => new Table(scope, "Users", new TableProps { /* ... */ })); // tableResource.Resource.Construct is a Table // Can chain with AddOutput, WithReference, etc. ``` -------------------------------- ### AddOutput Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates chaining AddOutput calls to expose bucket properties as outputs. ```csharp var bucket = stack.AddConstruct("data-bucket", scope => new Bucket(scope, "DataBucket")) .AddOutput("BucketName", b => b.BucketName) .AddOutput("BucketArn", b => b.BucketArn); ``` -------------------------------- ### Configure SQS queue with properties Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Example showing how to add an SQS queue with custom properties and configure a dead-letter queue. ```csharp var stack = builder.AddAWSCDKStack("messaging"); var taskQueue = stack.AddSQSQueue("process-tasks", new QueueProps { VisibilityTimeout = Duration.Seconds(30), MessageRetentionPeriod = Duration.Days(1) }); var dlqQueue = stack.AddSQSQueue("process-tasks-dlq"); taskQueue.Resource.Construct.DeadLetterQueue = new DeadLetterQueue { Queue = dlqQueue.Resource.Construct, MaxReceiveCount = 3 }; ``` -------------------------------- ### Implement a ConstructBuilderDelegate Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example implementation of a delegate to build a DynamoDB Table construct. ```csharp ConstructBuilderDelegate
tableBuilder = scope => new Table(scope, "UsersTable", new TableProps { PartitionKey = new Attribute { Name = "id", Type = AttributeType.STRING } }); ``` -------------------------------- ### Configuration Path to Environment Variable Mapping Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md Examples showing how configuration paths are transformed into environment variables using underscore separators. ```text AWS:Resources:users:UserPoolId → AWS_RESOURCES_USERS__USERPOOLID Cognito:UserPool:ClientId → COGNITO_USERPOOL__CLIENTID Database:Primary:ConnectionString → DATABASE_PRIMARY__CONNECTIONSTRING ``` -------------------------------- ### Implement a Custom Stack Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example of defining a custom Stack class and adding it to the Aspire builder. ```csharp public class AppStack : Stack { public Table UsersTable { get; } public Function ProcessorFunction { get; } public AppStack(Construct scope) : base(scope, "AppStack") { UsersTable = new Table(this, "Users", new TableProps { /* ... */ }); ProcessorFunction = new Function(this, "Processor", new FunctionProps { /* ... */ }); } } var stack = builder.AddAWSCDKStack("app", scope => new AppStack(scope)); ``` -------------------------------- ### Configure AWS SDK with Region and Profile Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sdk-config-extensions.md Example of initializing the AWS SDK configuration and chaining region and profile settings before building the application. ```csharp var builder = DistributedApplication.CreateBuilder(args); var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.USEast1) .WithProfile("my-profile"); var appHost = builder.Build(); appHost.Run(); ``` -------------------------------- ### Retrieve Construct Output Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates creating a reference to a bucket name output and passing it to a project environment variable. ```csharp var bucket = stack.AddConstruct("data", scope => new Bucket(scope, "DataBucket")); var bucketNameRef = bucket.GetOutput("BucketName", b => b.BucketName); var app = builder.AddProject("api") .WithEnvironment("DATA_BUCKET", bucketNameRef); ``` -------------------------------- ### Install AWS CDK CLI Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/README.md Global installation of the AWS CDK CLI required for synthesizing CloudFormation templates. ```bash npm install -g aws-cdk ``` -------------------------------- ### AddClient Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cognito-extensions.md Demonstrates configuring web and mobile application clients for a Cognito user pool with specific authentication flows and attributes. ```csharp var userPool = stack.AddCognitoUserPool("users"); var webClient = userPool.AddClient("web-app", new UserPoolClientOptions { UserPoolClientName = "WebApp", GenerateSecret = true, ExplicitAuthFlows = new[] { UserPoolClientAuthFlow.ADMIN_NO_SRP_AUTH, UserPoolClientAuthFlow.USER_PASSWORD_AUTH, UserPoolClientAuthFlow.ALLOW_REFRESH_TOKEN_AUTH }, ReadAttributes = new ClientAttributes { WithStandardAttributes("Email", "Name") }, WriteAttributes = new ClientAttributes { WithStandardAttributes("Email") } }); var mobileClient = userPool.AddClient("mobile-app", new UserPoolClientOptions { UserPoolClientName = "MobileApp", GenerateSecret = false, ExplicitAuthFlows = new[] { UserPoolClientAuthFlow.ALLOW_USER_PASSWORD_AUTH, UserPoolClientAuthFlow.ALLOW_REFRESH_TOKEN_AUTH } }); ``` -------------------------------- ### AddOutput Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates how to define a custom stack and expose a function ARN as a stack output using the AddOutput extension. ```csharp public class ApiStack : Stack { public Function ServiceFunction { get; set; } public ApiStack(Construct scope, string id) : base(scope, id) { ServiceFunction = new Function(this, "ServiceFunction", new FunctionProps { /* ... */ }); } } var apiStack = builder.AddAWSCDKStack("api", scope => new ApiStack(scope, "ApiStack")) .AddOutput("FunctionArn", stack => stack.ServiceFunction.FunctionArn); ``` -------------------------------- ### AddSNSTopic Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Demonstrates creating SNS topics with custom properties or default settings. ```csharp var stack = builder.AddAWSCDKStack("messaging"); var orderEvents = stack.AddSNSTopic("order-events", new TopicProps { DisplayName = "Order Events", TopicName = "OrderEvents" }); var emailNotifications = stack.AddSNSTopic("email-notifications"); ``` -------------------------------- ### Troubleshoot Invalid AWS Credentials Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/errors.md Examples showing how to identify and fix credential configuration issues. ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithProfile("non-existent-profile"); // Profile doesn't exist in ~/.aws/credentials ``` ```bash # List available profiles aws configure list-profiles # Create credentials for a profile aws configure --profile development ``` ```csharp // Use correct profile var awsConfig = builder.AddAWSSDKConfig() .WithProfile("development"); ``` -------------------------------- ### Adding DynamoDB Table References Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/dynamodb-extensions.md Example showing how to link multiple DynamoDB tables to API and worker projects with custom configuration sections. ```csharp var stack = builder.AddAWSCDKStack("database"); var usersTable = stack.AddDynamoDBTable("users", new TableProps { PartitionKey = new Attribute { Name = "userId", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }); var ordersTable = stack.AddDynamoDBTable("orders", new TableProps { PartitionKey = new Attribute { Name = "orderId", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }); var api = builder.AddProject("api") .WithReference(usersTable) .WithReference(ordersTable, configSection: "DynamoDB:Tables:Orders"); var worker = builder.AddProject("worker") .WithReference(usersTable, configSection: "Database:Users") .WithReference(ordersTable, configSection: "Database:Orders"); ``` -------------------------------- ### AddSubscription Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Shows how to link multiple SQS queues to an SNS topic for message delivery. ```csharp var orderTopic = stack.AddSNSTopic("orders"); var orderQueue = stack.AddSQSQueue("order-processing"); var auditQueue = stack.AddSQSQueue("order-audit"); orderTopic.AddSubscription(orderQueue); orderTopic.AddSubscription(auditQueue); ``` -------------------------------- ### AddKinesisStream Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Demonstrates adding Kinesis streams in both provisioned and on-demand modes within a CDK stack. ```csharp var stack = builder.AddAWSCDKStack("streaming"); var eventStream = stack.AddKinesisStream("events", new StreamProps { ShardCount = 1 }); var analyticsStream = stack.AddKinesisStream("analytics"); ``` -------------------------------- ### Configure CloudFormation template parameters Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example of adding parameters to a CloudFormation template resource during configuration. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("infra", "template.yaml") .WithParameter("Environment", "production") .WithParameter("InstanceType", "t3.large"); ``` -------------------------------- ### Inject stack output into project environment Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Example of retrieving a stack output and injecting it as an environment variable into a project. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("infra", "template.yaml"); var dbEndpointRef = cfnStack.GetOutput("DatabaseEndpoint"); var api = builder.AddProject("api") .WithEnvironment("DB_URL", dbEndpointRef); ``` -------------------------------- ### WithReference Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates linking a DynamoDB table construct to a web project, mapping the table name to a specific configuration section. ```csharp var table = stack.AddConstruct("users-table", scope => new Table(scope, "UsersTable", new TableProps { /* ... */ })); var webApp = builder.AddProject("web") .WithReference(table, t => t.TableName, "TableName", configSection: "DynamoDB:Tables"); ``` -------------------------------- ### WithReference Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Shows how to link a Kinesis stream to producer and consumer projects, optionally specifying a custom configuration section. ```csharp var eventStream = stack.AddKinesisStream("events"); var eventProducer = builder.AddProject("producer") .WithReference(eventStream); var eventConsumer = builder.AddProject("consumer") .WithReference(eventStream, configSection: "Kinesis:Streams:Events"); ``` -------------------------------- ### Inject SQS queue reference into projects Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sqs-sns-kinesis-extensions.md Example demonstrating how to reference an SQS queue in worker and API projects with optional configuration sections. ```csharp var taskQueue = stack.AddSQSQueue("tasks"); var worker = builder.AddProject("worker") .WithReference(taskQueue); var api = builder.AddProject("api") .WithReference(taskQueue, configSection: "Queues:Tasks"); ``` -------------------------------- ### Example: Add Typed AWS CDK Stack Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Shows how to define a custom CDK stack class and add it to the application builder using a delegate. ```csharp public class DatabaseStack : Stack { public Table Table { get; } public DatabaseStack(Construct scope, string id) : base(scope, id) { Table = new Table(this, "users", new TableProps { PartitionKey = new Attribute { Name = "id", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }); } } var dbStack = builder.AddAWSCDKStack("database", scope => new DatabaseStack(scope, "DatabaseStack")); ``` -------------------------------- ### AddDynamoDBTable Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/dynamodb-extensions.md Demonstrates adding a DynamoDB table with a partition key and billing mode configuration to a CDK stack. ```csharp var stack = builder.AddAWSCDKStack("database"); var usersTable = stack.AddDynamoDBTable("users", new TableProps { PartitionKey = new Attribute { Name = "userId", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }); ``` -------------------------------- ### Handle Template Output Errors Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/errors.md Examples of invalid output references and the corresponding template configuration to fix them. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("stack", "template.yaml"); // Template doesn't define this output var output = cfnStack.GetOutput("NonExistentOutput"); ``` ```yaml # template.yaml Outputs: DatabaseEndpoint: Description: RDS database endpoint Value: !GetAtt MyDatabase.Endpoint.Address Export: Name: !Sub "${AWS::StackName}-DBEndpoint" ``` ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("stack", "template.yaml"); var dbEndpoint = cfnStack.GetOutput("DatabaseEndpoint"); ``` -------------------------------- ### Configure AWS Region Endpoints Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/errors.md Examples of setting valid AWS regions and a list of common region constants. ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.GetBySystemName("invalid-region")); ``` ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.USEast1); ``` ```csharp RegionEndpoint.USEast1 // us-east-1 RegionEndpoint.USEast2 // us-east-2 RegionEndpoint.USWest1 // us-west-1 RegionEndpoint.USWest2 // us-west-2 RegionEndpoint.EUWest1 // eu-west-1 RegionEndpoint.EUCentral1 // eu-central-1 RegionEndpoint.APNortheast1 // ap-northeast-1 // ... etc. ``` -------------------------------- ### Example: Add AWS CDK Stack with Custom Name Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates adding a CDK stack resource to the application builder with a custom CloudFormation stack name. ```csharp var stack = builder.AddAWSCDKStack("infra", "my-app-prod-stack"); ``` -------------------------------- ### AddCognitoUserPool Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cognito-extensions.md Demonstrates configuring a Cognito user pool with custom properties such as password policies, MFA, and sign-in aliases. ```csharp var stack = builder.AddAWSCDKStack("authentication"); var userPool = stack.AddCognitoUserPool("users", new UserPoolProps { UserPoolName = "MyAppUsers", SelfSignUpEnabled = true, SignInAliases = new SignInAliases { Email = true, Username = true }, PasswordPolicy = new PasswordPolicy { MinLength = 12, RequireLowercase = true, RequireUppercase = true, RequireDigits = true, RequireSymbols = false }, MfaConfiguration = MfaConfiguration.OPTIONAL, Mfa = Mfa.TOTP, StandardAttributes = new StandardAttributes { Email = new StandardAttribute { Required = true, Mutable = true } } }); ``` -------------------------------- ### Configure DynamoDB Table and Index Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates creating a DynamoDB table with a partition key and adding a global secondary index within an AWS CDK stack. ```csharp var stack = builder.AddAWSCDKStack("database"); var usersTable = stack.AddDynamoDBTable("users", new TableProps { PartitionKey = new Attribute { Name = "userId", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }) .AddGlobalSecondaryIndex(new GlobalSecondaryIndexProps { IndexName = "EmailIndex", PartitionKey = new Attribute { Name = "email", Type = AttributeType.STRING } }); var api = builder.AddProject("api") .WithReference(usersTable); ``` -------------------------------- ### Create SNS Topics and Subscriptions Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Shows how to create an SNS topic, add SQS queue subscriptions, and reference the topic in a project. ```csharp var stack = builder.AddAWSCDKStack("messaging"); var orderTopic = stack.AddSNSTopic("orders"); var orderQueue = stack.AddSQSQueue("order-processing"); var auditQueue = stack.AddSQSQueue("order-audit"); orderTopic.AddSubscription(orderQueue); orderTopic.AddSubscription(auditQueue); var service = builder.AddProject("service") .WithReference(orderTopic); ``` -------------------------------- ### Configure S3 Bucket and Event Notifications Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates creating an S3 bucket and configuring an object creation notification to an SQS queue. ```csharp var stack = builder.AddAWSCDKStack("storage"); var uploadBucket = stack.AddS3Bucket("uploads", new BucketProps { Versioned = true }); var processingQueue = stack.AddSQSQueue("processing"); uploadBucket.AddObjectCreatedNotification(processingQueue, new KeyFilter { Prefix = "documents/" }); var processor = builder.AddProject("processor") .WithReference(uploadBucket) .WithReference(processingQueue); ``` -------------------------------- ### AddObjectRemovedNotification Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/s3-extensions.md Configures an S3 bucket to send removal notifications to a specified SNS topic. ```csharp var archiveBucket = stack.AddS3Bucket("archives"); var notificationTopic = stack.AddSNSTopic("archive-events"); archiveBucket.AddObjectRemovedNotification(notificationTopic); ``` -------------------------------- ### Usage of PublishAsRDSPostgres Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/docs/deployment-design.md Demonstrates how to configure and publish a Postgres resource with custom instance settings. ```csharp var postgres = builder.AddPostgres("mydb") .PublishAsRDSPostgres(new PublishRDSPostgresConfig { PropsDatabaseInstanceCallback = (ctx, props) => { props.InstanceType = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.SMALL); props.AllocatedStorage = 100; } }); var webApp = builder.AddProject("webapp") .WithReference(postgres); // Will get connection string via environment variable ``` -------------------------------- ### AddLocalSecondaryIndex Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/dynamodb-extensions.md Demonstrates adding a local secondary index to a DynamoDB table during resource definition. ```csharp var ordersTable = stack.AddDynamoDBTable("orders", new TableProps { PartitionKey = new Attribute { Name = "customerId", Type = AttributeType.STRING }, SortKey = new Attribute { Name = "orderId", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }) .AddLocalSecondaryIndex(new LocalSecondaryIndexProps { IndexName = "OrderDateIndex", SortKey = new Attribute { Name = "orderDate", Type = AttributeType.STRING } }); ``` -------------------------------- ### Configure S3 Bucket with AddS3Bucket Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md Creates an S3 bucket with versioning, public access blocking, and lifecycle rules for storage class transitions. ```csharp var bucket = stack.AddS3Bucket("data-lake", new BucketProps { Versioned = true, BlockPublicAccess = BlockPublicAccess.BlockAll(), LifecycleRules = new[] { new LifecycleRule { Transitions = new[] { new Transition { StorageClass = StorageClass.STANDARD_IA, TransitionAfter = Duration.Days(30) }, new Transition { StorageClass = StorageClass.GLACIER, TransitionAfter = Duration.Days(90) } } } } }); ``` -------------------------------- ### AddObjectRemovedNotification Usage Example Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/s3-extensions.md Demonstrates how to attach an SQS queue to an S3 bucket to receive notifications when objects are removed. ```csharp var dataBucket = stack.AddS3Bucket("data"); var auditQueue = stack.AddSQSQueue("deletion-audit-queue"); dataBucket.AddObjectRemovedNotification(auditQueue); ``` -------------------------------- ### Use a custom CloudFormation client Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cloudformation-extensions.md Shows how to provide a custom client, useful for local testing or emulators like LocalStack. ```csharp var customClient = new AmazonCloudFormationClient( new AmazonCloudFormationConfig { ServiceURL = "http://localhost:4566" }); var cfnStack = builder.AddAWSCloudFormationTemplate("stack", "template.yaml") .WithReference(customClient); ``` -------------------------------- ### Create and Reference an SQS Queue Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates adding an SQS queue to an AWS CDK stack and referencing it in a .NET Aspire project. ```csharp var stack = builder.AddAWSCDKStack("messaging"); var taskQueue = stack.AddSQSQueue("tasks", new QueueProps { VisibilityTimeout = Duration.Seconds(300), MessageRetentionPeriod = Duration.Days(1) }); var worker = builder.AddProject("worker") .WithReference(taskQueue); ``` -------------------------------- ### Bedrock AccessDeniedException Error Message Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/docs/deployment-design.md Example of the error encountered when the execution role lacks necessary bedrock:InvokeModel permissions. ```text AccessDeniedException: User: arn:aws:sts:::assumed-role/...DefaultAgentCoreRuntimeRole.../... is not authorized to perform: bedrock:InvokeModel on resource: arn:aws:bedrock:us-west-2::inference-profile/global.anthropic.claude-sonnet-4-6 because no identity-based policy allows the bedrock:InvokeModel action ``` -------------------------------- ### Add AWS CloudFormation Template to Aspire Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cloudformation-extensions.md Example of registering a CloudFormation template resource within an Aspire application host. ```csharp var builder = DistributedApplication.CreateBuilder(args); var cfnStack = builder.AddAWSCloudFormationTemplate( "database-stack", "templates/database.yaml", stackName: "my-app-database"); var appHost = builder.Build(); appHost.Run(); ``` -------------------------------- ### View Documentation Files via CLI Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/DOCUMENTATION-SUMMARY.md Commands to access various documentation files located in the output directory. ```bash # View the main reference cat /workspace/home/output/README.md # Browse API index cat /workspace/home/output/API-INDEX.md # View specific service documentation cat /workspace/home/output/api-reference/dynamodb-extensions.md # See type definitions cat /workspace/home/output/types.md # Review configuration options cat /workspace/home/output/configuration.md # Check error reference cat /workspace/home/output/errors.md ``` -------------------------------- ### Configure Automatic AWS Resource Mapping Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/README.md Demonstrates how to initialize the AWS CDK environment and define resources that automatically map to AWS services like ECS Fargate, Lambda, and ElastiCache. ```csharp // Add to opt-in to using the preview publish/deployment APIs. #pragma warning disable ASPIREAWSPUBLISHERS001 var builder = DistributedApplication.CreateBuilder(args); builder.AddAWSCDKEnvironment( name: "MyApp", cdkDefaultsProviderFactory: CDKDefaultsProviderFactory.Preview_V1 ); // Web projects automatically deploy to ECS Fargate Express var webApp = builder.AddProject("webapp"); // Lambda functions automatically deploy to AWS Lambda var function = builder.AddAWSLambdaFunction("function", ""); // Redis automatically deploys to ElastiCache var cache = builder.AddRedis("cache"); builder.Build().Run(); ``` -------------------------------- ### Trigger Invalid CloudFormation Template Error Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/errors.md Example of code that triggers a provisioning error due to a malformed CloudFormation template. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("stack", "invalid-template.yaml"); // Template is malformed ``` -------------------------------- ### View Project File Structure Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/INDEX.md Displays the directory layout of the documentation project. ```text /output/ ├── INDEX.md (this file) ├── README.md (start here) ├── API-INDEX.md (quick lookup) ├── DOCUMENTATION-SUMMARY.md (generation summary) ├── api-reference/ │ ├── sdk-config-extensions.md │ ├── cloudformation-extensions.md │ ├── cdk-extensions.md │ ├── dynamodb-extensions.md │ ├── s3-extensions.md │ ├── sqs-sns-kinesis-extensions.md │ └── cognito-extensions.md ├── types.md ├── configuration.md └── errors.md ``` -------------------------------- ### Using WithReference in Aspire Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cloudformation-extensions.md Demonstrates linking a CloudFormation stack to project resources, showing default and custom configuration section mapping. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("infrastructure", "template.yaml") .WithParameter("Environment", "dev"); var webApp = builder.AddProject("api") .WithReference(cfnStack); // Outputs available as AWS:Resources:StackKey1, etc. var worker = builder.AddProject("worker") .WithReference(cfnStack, configSection: "CloudFormation:Outputs"); ``` -------------------------------- ### Configure AWS CDK Stacks and Constructs in Aspire Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates adding a CDK stack, defining a DynamoDB table construct, and injecting the table name into an API project environment variable. ```csharp var stack = builder.AddAWSCDKStack("infrastructure"); var table = stack.AddConstruct("users", scope => new Table(scope, "UsersTable", new TableProps { PartitionKey = new Attribute { Name = "id", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST })) .AddOutput("TableName", t => t.TableName); var api = builder.AddProject("api") .WithEnvironment("USERS_TABLE", table, t => t.TableName); ``` -------------------------------- ### Inject CDK Construct Output as Environment Variable Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Example of using WithEnvironment to pass a bucket name from a CDK construct to an Aspire project. ```csharp var bucket = stack.AddConstruct("uploads", scope => new Bucket(scope, "UploadsBucket")); var api = builder.AddProject("api") .WithEnvironment("UPLOADS_BUCKET_NAME", bucket, b => b.BucketName); ``` -------------------------------- ### List and Create AWS Profiles Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md CLI commands to manage AWS credential profiles. ```bash aws configure list-profiles ``` ```bash aws configure --profile development ``` -------------------------------- ### Use CloudFormation Templates Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Deploys a CloudFormation template with parameters and tags, then maps an output to an environment variable. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("database", "templates/db.yaml") .WithParameter("DatabaseSize", "db.t3.micro") .WithTag("Environment", "dev"); var dbEndpoint = cfnStack.GetOutput("DatabaseEndpoint"); var api = builder.AddProject("api") .WithEnvironment("DB_URL", dbEndpoint); ``` -------------------------------- ### Referencing S3 Buckets in Projects Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/s3-extensions.md Demonstrates how to link multiple S3 buckets to different project resources with custom configuration sections. ```csharp var stack = builder.AddAWSCDKStack("storage"); var dataLake = stack.AddS3Bucket("data-lake"); var archiveBucket = stack.AddS3Bucket("archives"); var api = builder.AddProject("api") .WithReference(dataLake) .WithReference(archiveBucket, configSection: "Storage:Archives"); var processor = builder.AddProject("processor") .WithReference(dataLake, configSection: "S3:DataLake") .WithReference(archiveBucket, configSection: "S3:Archives"); ``` -------------------------------- ### Bootstrap AWS CDK Environment Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/README.md Initializes the target AWS account and region for CDK deployments. ```bash cdk bootstrap aws://ACCOUNT-NUMBER/REGION ``` -------------------------------- ### Configure AWS SDK using fluent builder pattern Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Chains configuration methods to set region, profile, and SDK validation settings. ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.USEast1) .WithProfile("development") .WithSdkValidation(true); ``` -------------------------------- ### Add AWS SDK Reference to Resource Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/sdk-config-extensions.md Defines the method signature for injecting AWS SDK configuration into a resource builder and provides a usage example. ```csharp public static IResourceBuilder WithReference( this IResourceBuilder builder, IAWSSDKConfig awsSdkConfig) where TDestination : IResourceWithEnvironment ``` ```csharp var builder = DistributedApplication.CreateBuilder(args); var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.USEast1) .WithProfile("production"); var webApi = builder.AddProject("api") .WithReference(awsConfig); var appHost = builder.Build(); appHost.Run(); ``` -------------------------------- ### Configure Lambda Test Tool Emulator Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Customize the automatic installation behavior of the Amazon Lambda Test Tool by calling AddAWSLambdaServiceEmulator before registering Lambda functions. ```csharp builder.AddAWSLambdaServiceEmulator(new LambdaEmulatorOptions { DisableAutoInstall = false, OverrideMinimumInstallVersion = "0.1.0", AllowDowngrade = false }); // Add Lambda functions after configuring the emulator var function = builder.AddAWSLambdaFunction("MyFunction", "MyFunction"); ``` -------------------------------- ### Accessing AWS Configuration in .NET Aspire Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md Demonstrates retrieving configuration values via environment variables, IConfiguration, and the options pattern. ```csharp // Via environment variable var value = Environment.GetEnvironmentVariable("AWS_RESOURCES_USERS__USERPOOLID"); // Via IConfiguration var value = configuration["AWS:Resources:users:UserPoolId"]; // Via options pattern services.Configure( configuration.GetSection("AWS:Resources:users")); public class CognitoOptions { public string UserPoolId { get; set; } } ``` -------------------------------- ### Configure AWS SDK with Validation Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/errors.md Enable SDK validation at startup to catch configuration errors early. ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithProfile("development") .WithRegion(RegionEndpoint.USEast1) .WithSdkValidation(true); // Validates at startup ``` -------------------------------- ### Configure CloudFormation Stack in .NET Aspire Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates adding a CloudFormation template, setting parameters and tags, and injecting stack outputs into a project. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("infrastructure", "template.yaml") .WithParameter("Environment", "dev") .WithTag("Owner", "platform"); var dbEndpoint = cfnStack.GetOutput("DatabaseEndpoint"); var api = builder.AddProject("api") .WithEnvironment("DB_URL", dbEndpoint) .WithReference(cfnStack); ``` -------------------------------- ### Register AWS resources using extension methods Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Demonstrates how to use extension methods on IDistributedApplicationBuilder and IResourceBuilder to add AWS SDK configuration and infrastructure resources. ```csharp // Extension on IDistributedApplicationBuilder var awsConfig = builder.AddAWSSDKConfig(); // Extension on IResourceBuilder<> var stack = builder.AddAWSCDKStack("infrastructure"); // Extension on resource builders var table = stack.AddDynamoDBTable("users", props); // Extension on resource builders var api = builder.AddProject("api") .WithReference(table); ``` -------------------------------- ### Apply SDK configuration to a CloudFormation stack Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cloudformation-extensions.md Demonstrates using WithReference to apply specific region and profile settings to a CloudFormation stack. ```csharp var awsConfig = builder.AddAWSSDKConfig() .WithRegion(RegionEndpoint.USEast1) .WithProfile("production"); var cfnStack = builder.AddAWSCloudFormationTemplate("stack", "template.yaml") .WithReference(awsConfig); ``` -------------------------------- ### Adding Constructs to a Stack Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cdk-extensions.md Demonstrates how to add S3 buckets and SQS queues to an AWS CDK stack within an Aspire project. ```csharp var stack = builder.AddAWSCDKStack("infrastructure"); var bucket = stack.AddConstruct("data-bucket", scope => new Bucket(scope, "DataBucket", new BucketProps { Versioned = true, RemovalPolicy = RemovalPolicy.RETAIN })); var queue = stack.AddConstruct("events-queue", scope => new Queue(scope, "EventsQueue")); ``` -------------------------------- ### Configure AgentCore Local Options Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Customize emulator ports and logging behavior for local development. ```csharp builder.AddAgentCoreRuntime("my-agent", new AgentCoreLocalOptions { IncludeEmulatorLogs = true, // Route emulator logs to the Aspire dashboard RuntimeEmulatorPort = 9000, // Pin the runtime emulator port (default: OS-assigned) ChatAppPort = 9001, // Pin the chat app port (default: OS-assigned) MemoryEmulatorPort = 9002 // Pin the memory emulator port (default: OS-assigned) }); ``` -------------------------------- ### Inject configuration via WithReference Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Automatically injects resource configuration into projects using environment variables. ```csharp // Injects AWS_RESOURCES_USERS__TABLENAME environment variable // Also available as configuration: AWS:Resources:users:TableName var api = builder.AddProject("api") .WithReference(usersTable); ``` -------------------------------- ### Create a CDK Stack with Resources Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Defines an infrastructure stack and adds DynamoDB, S3, and SQS resources using CDK constructs. ```csharp var stack = builder.AddAWSCDKStack("infrastructure"); var table = stack.AddDynamoDBTable("users", new TableProps { PartitionKey = new Attribute { Name = "id", Type = AttributeType.STRING }, BillingMode = BillingMode.PAY_PER_REQUEST }); var bucket = stack.AddS3Bucket("data-lake"); var queue = stack.AddSQSQueue("tasks"); ``` -------------------------------- ### Configure API Gateway Emulator with Wildcard Paths Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Uses the {proxy+} syntax to capture remaining URL paths and route them to a Lambda function. ```csharp // Add an ASP.NET Core Lambda function var aspNetCoreLambdaFunction = builder.AddAWSLambdaFunction("Resource", "AWSServerless"); // Configure the API Gateway emulator builder.AddAWSAPIGatewayEmulator("APIGatewayEmulator", APIGatewayType.Rest) .WithReference(aspNetCoreLambdaFunction, Method.Any, "/") .WithReference(aspNetCoreLambdaFunction, Method.Any, "/{proxy+}"); ``` -------------------------------- ### Configure SNS Topic with AddSNSTopic Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md Initializes an SNS topic with a display name and physical topic name. ```csharp var topic = stack.AddSNSTopic("orders", new TopicProps { DisplayName = "Order Events", TopicName = "OrderEvents", Fifo = false }); ``` -------------------------------- ### Connect Resources with WithReference Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/README.md Configures connectivity between resources, such as a web application and a cache, by automatically handling environment variables, VPC attachment, and security groups. ```csharp var builder = DistributedApplication.CreateBuilder(args); builder.AddAWSCDKEnvironment( name: "MyApp", cdkDefaultsProviderFactory: CDKDefaultsProviderFactory.Preview_V1 ); var cache = builder.AddRedis("cache"); // Connect the web app to the cache var webApp = builder.AddProject("webapp") .WithReference(cache); builder.Build().Run(); ``` -------------------------------- ### AddS3Bucket Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/configuration.md Configures an S3 bucket using IBucketProps. ```APIDOC ## AddS3Bucket ### Description Configures and adds an S3 bucket to the stack using `IBucketProps`. ### Parameters - **Versioned** (bool) - Optional - Enable object versioning - **RemovalPolicy** (RemovalPolicy) - Optional - Behavior on stack deletion - **BlockPublicAccess** (BlockPublicAccess) - Optional - Public access settings - **LifecycleRules** (LifecycleRule[]) - Optional - Object lifecycle policies - **ServerAccessLogsPrefix** (string) - Optional - S3 server access logs prefix - **Encryption** (BucketEncryption) - Optional - Encryption configuration ``` -------------------------------- ### Create and Reference Cognito User Pool Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Demonstrates creating a Cognito user pool with client configuration and referencing it in a web application project. ```csharp var stack = builder.AddAWSCDKStack("authentication"); var userPool = stack.AddCognitoUserPool("users", new UserPoolProps { SelfSignUpEnabled = true, SignInAliases = new SignInAliases { Email = true } }); var webClient = userPool.AddClient("web-app"); var webApp = builder.AddProject("web") .WithReference(userPool); ``` -------------------------------- ### AutoVer Change File Creation Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/CONTRIBUTING.md Command to create a change file using the AutoVer tool. ```bash autover change --project-name "Aspire.Hosting.AWS" -m "Fixed an issue causing a failure somewhere ``` -------------------------------- ### Configure AgentCore in AppHost Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/src/Aspire.Hosting.AWS/README.md Register agents and wire them to consumer projects within the Aspire AppHost. ```csharp #pragma warning disable ASPIREAWSAGENTCORE001 var builder = DistributedApplication.CreateBuilder(args); // Register a non-streaming agent with short-term memory var agent = builder.AddAgentCoreRuntime("my-agent") .WithAgentCoreMemory(); // Register a streaming agent builder.AddAgentCoreRuntime("my-streaming-agent") .WithAgentCoreStreaming() .WithAgentCoreMemory(); // Wire a consumer project — AWS_ENDPOINT_URL_BEDROCK_AGENTCORE is injected automatically builder.AddProject("ChatUI") .WithReference(agent); builder.Build().Run(); ``` -------------------------------- ### Injecting CloudFormation Outputs as Environment Variables Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/cloudformation-extensions.md Demonstrates how to link CloudFormation stack outputs to project environment variables using the WithEnvironment extension. ```csharp var cfnStack = builder.AddAWSCloudFormationTemplate("infra", "template.yaml"); var webApp = builder.AddProject("api") .WithEnvironment("DATABASE_URL", cfnStack.GetOutput("DbEndpoint")) .WithEnvironment("CACHE_URL", cfnStack.GetOutput("CacheEndpoint")); ``` -------------------------------- ### Implement IsDefaultPublishTargetMatch for deployment targets Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/docs/deployment-design.md Use these implementations to define how specific resources match to deployment targets. The rank property determines priority when multiple targets match a single resource. ```csharp public override IsDefaultPublishTargetMatchResult IsDefaultPublishTargetMatch( CDKDefaultsProvider cdkDefaultsProvider, IResource resource) { if (resource is ProjectResource projectResource && projectResource.GetEndpoints().Any() && // Has HTTP endpoints cdkDefaultsProvider.DefaultWebProjectResourcePublishTarget == CDKDefaultsProvider.WebProjectResourcePublishTarget.ECSFargateExpressService) { return new IsDefaultPublishTargetMatchResult { IsMatch = true, PublishTargetAnnotation = new PublishECSFargateServiceExpressAnnotation(), Rank = IsDefaultPublishTargetMatchResult.DEFAULT_MATCH_RANK + 100 }; } return IsDefaultPublishTargetMatchResult.NO_MATCH; } ``` ```csharp public override IsDefaultPublishTargetMatchResult IsDefaultPublishTargetMatch( CDKDefaultsProvider cdkDefaultsProvider, IResource resource) { if (resource is LambdaProjectResource && cdkDefaultsProvider.DefaultLambdaProjectResourcePublishTarget == CDKDefaultsProvider.LambdaProjectResourcePublishTarget.LambdaFunction) { return new IsDefaultPublishTargetMatchResult { IsMatch = true, PublishTargetAnnotation = new PublishLambdaFunctionAnnotation(), Rank = IsDefaultPublishTargetMatchResult.DEFAULT_MATCH_RANK + 200 // Higher rank }; } return IsDefaultPublishTargetMatchResult.NO_MATCH; } ``` ```csharp public override IsDefaultPublishTargetMatchResult IsDefaultPublishTargetMatch( CDKDefaultsProvider cdkDefaultsProvider, IResource resource) { // Match any ProjectResource that was registered via AddAgentCoreRuntime() if (resource is ProjectResource && resource.Annotations.OfType().Any()) { return new IsDefaultPublishTargetMatchResult { IsMatch = true, PublishTargetAnnotation = new PublishAgentCoreRuntimeAnnotation(), Rank = IsDefaultPublishTargetMatchResult.DEFAULT_MATCH_RANK + 200 }; } return IsDefaultPublishTargetMatchResult.NO_MATCH; } ``` -------------------------------- ### Reference Resources in Applications Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/README.md Injects provisioned infrastructure resources into a .NET project using WithReference. ```csharp var api = builder.AddProject("api") .WithReference(table) .WithReference(bucket) .WithReference(queue); ``` -------------------------------- ### Override Default Configuration Section Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/types.md Demonstrates using the default configuration section versus providing a custom section when referencing AWS resources. ```csharp // Uses default section: AWS:Resources:tableName var table = stack.AddDynamoDBTable("tableName", props); var api = builder.AddProject("api") .WithReference(table); // Uses custom section: Custom:DynamoDB:Tables var api2 = builder.AddProject("api2") .WithReference(table, "Custom:DynamoDB:Tables"); ``` -------------------------------- ### Reference Methods Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/API-INDEX.md Methods for referencing construct outputs in application configuration or environment variables. ```APIDOC ## Reference Methods ### Description Methods to link construct outputs to other resources within the application. ### Methods - `WithReference(IResourceBuilder, IResourceBuilder>, ConstructOutputDelegate, string, string?)`: Reference construct output in config. - `WithEnvironment(IResourceBuilder, string, IResourceBuilder>, ConstructOutputDelegate, string?)`: Inject construct output as environment variable. ``` -------------------------------- ### Configure S3 bucket notification with SQS Source: https://github.com/aws/integrations-on-dotnet-aspire-for-aws/blob/main/_autodocs/api-reference/s3-extensions.md Demonstrates subscribing an SQS queue to an S3 bucket with a key prefix filter. ```csharp var uploadBucket = stack.AddS3Bucket("uploads"); var processingQueue = stack.AddSQSQueue("processing-queue"); uploadBucket.AddObjectCreatedNotification(processingQueue, new KeyFilter { Prefix = "documents/" }); ```