{ "$schema": "./aws-deploy-recipe-schema.json", "Id": "BlazorWasm", "Version": "1.0.1", "Name": "Blazor WebAssembly App", "DeploymentType": "CdkProject", "DeploymentBundle": "DotnetPublishZipFile", "CdkProjectTemplate": "../CdkTemplates/BlazorWasm", "CdkProjectTemplateId": "netdeploy.BlazorWasm", "ShortDescription": "Hosts Blazor WebAssembly application in an Amazon S3 bucket with Amazon CloudFront as a content delivery network.", "Description": "This Blazor WebAssembly application will be built and hosted in a new Amazon Simple Storage Service (Amazon S3) bucket. The Blazor application will be exposed publicly through a CloudFront distribution using the Amazon S3 bucket as the origin.", "TargetService": "Amazon S3", "TargetPlatform": "Linux", "DisplayedResources": [ { "LogicalId": "RecipeCloudFrontDistribution2BE25932", "Description": "CloudFront Distribution" }, { "LogicalId": "RecipeContentS3BucketE74B8362", "Description": "S3 Bucket for web application content" }, { "LogicalId": "RecipeAccessLoggingBucket3DC188EF", "Description": "S3 Bucket for storing access logs" } ], "RecipePriority": -1, "RecommendationRules": [ { "Comment": "Blazor WebAssembly apps starting with .NET 5.0 used a new Microsoft.NET.Sdk.BlazorWebAssembly SDK attribute.", "Tests": [ { "Type": "MSProjectSdkAttribute", "Condition": { "Value": "Microsoft.NET.Sdk.BlazorWebAssembly" } }, { "Type": "NuGetPackageReference", "Condition": { "NuGetPackageName": "Microsoft.AspNetCore.Components.WebAssembly" } } ], "Effect": { "Pass": { "Include": true, "PriorityAdjustment": 100 }, "Fail": { "Include": true } } }, { "Comment": "Blazor WebAssembly apps built for .NET 3.1 use the same SDK attribute as regular ASP.NET Core.", "Tests": [ { "Type": "MSProjectSdkAttribute", "Condition": { "Value": "Microsoft.NET.Sdk.Web" } }, { "Type": "MSProperty", "Condition": { "PropertyName": "TargetFramework", "AllowedValues": [ "netstandard2.1" ] } }, { "Type": "NuGetPackageReference", "Condition": { "NuGetPackageName": "Microsoft.AspNetCore.Components.WebAssembly" } } ], "Effect": { "Pass": { "Include": true, "PriorityAdjustment": 100 }, "Fail": { "Include": true } } } ], "Categories": [ { "Id": "General", "DisplayName": "General", "Order": 10 }, { "Id": "BackendAPI", "DisplayName": "Backend API", "Order": 20 }, { "Id": "Logging", "DisplayName": "Logging", "Order": 30 }, { "Id": "Networking", "DisplayName": "Networking", "Order": 40 } ], "OptionSettings": [ { "Id": "IndexDocument", "Name": "Index Document", "Category": "General", "Description": "The default page to use when the endpoint is accessed with no resource path.", "Type": "String", "DefaultValue": "index.html", "AdvancedSetting": false, "Updatable": true }, { "Id": "ErrorDocument", "Name": "Error Document", "Category": "General", "Description": "The error page to use when an error occurs while accessing the resource path.", "Type": "String", "DefaultValue": "", "AdvancedSetting": false, "Updatable": true }, { "Id": "Redirect404ToRoot", "Name": "Redirect 404 and 403 Errors", "Category": "General", "Description": "Redirect any 404 and 403 requests to the index document. This is useful in Blazor applications that modify the resource path in the browser. If the modified resource path is reused in a new browser it will result in a 403 from Amazon CloudFront since no S3 object exists at that resource path.", "Type": "Bool", "DefaultValue": true, "AdvancedSetting": false, "Updatable": true }, { "Id": "BackendApi", "Name": "Backend REST API", "Category": "BackendAPI", "Description": "URI to a backend rest api that will be added as an origin to the CloudFront distribution. For example an API Gateway endpoint.", "Type": "Object", "DefaultValue": "", "AdvancedSetting": false, "Updatable": true, "ChildOptionSettings": [ { "Id": "Enable", "Name": "Enable", "Description": "Enable adding backend rest api", "Type": "Bool", "DefaultValue": false, "AdvancedSetting": false, "Updatable": true }, { "Id": "Uri", "Name": "Uri", "Description": "Uri to the backend rest api", "Type": "String", "DefaultValue": "", "AdvancedSetting": false, "Updatable": true, "DependsOn": [ { "Id": "BackendApi.Enable", "Value": true } ], "Validators": [ { "ValidatorType": "Uri" }, { "ValidatorType": "Required" } ] }, { "Id": "ResourcePathPattern", "Name": "Resource Path Pattern", "Description": "The resource path pattern to determine which request go to backend rest api. (i.e. \"/api/*\") ", "Type": "String", "DefaultValue": "/api/*", "AdvancedSetting": false, "Updatable": true, "DependsOn": [ { "Id": "BackendApi.Enable", "Value": true } ], "Validators": [ { "ValidatorType": "Regex", "Configuration": { "Regex": "^/\\S+$", "ValidationFailedMessage": "Invalid resource path pattern. The resource path must start with a forward slash (/) followed by one or more unicode characters" } } ] } ] }, { "Id": "AccessLogging", "Name": "CloudFront Access Logging", "Category": "Logging", "Description": "Configure if and how access logs are written for the CloudFront distribution", "Type": "Object", "AdvancedSetting": false, "Updatable": true, "ChildOptionSettings": [ { "Id": "Enable", "Name": "Enable", "Description": "Enable CloudFront Access Logging", "Type": "Bool", "DefaultValue": false, "AdvancedSetting": false, "Updatable": true }, { "Id": "LogIncludesCookies", "Name": "Log Cookies", "Description": "Include cookies in access logs", "Type": "Bool", "DefaultValue": false, "AdvancedSetting": true, "Updatable": true, "DependsOn": [ { "Id": "AccessLogging.Enable", "Value": true } ] }, { "Id": "CreateLoggingS3Bucket", "Name": "Create Logging Bucket", "Description": "Create new S3 bucket for access logs to be stored. Bucket and logs will be retained after deployment is deleted.", "Type": "Bool", "DefaultValue": true, "AdvancedSetting": true, "Updatable": true, "DependsOn": [ { "Id": "AccessLogging.Enable", "Value": true } ] }, { "Id": "ExistingS3LoggingBucket", "Name": "Logging Bucket", "Description": "S3 bucket to use for storing access logs", "Type": "String", "TypeHint": "S3BucketName", "TypeHintData": { "AllowNoValue": true }, "DefaultValue": true, "AdvancedSetting": true, "Updatable": true, "DependsOn": [ { "Id": "AccessLogging.Enable", "Value": true }, { "Id": "AccessLogging.CreateLoggingS3Bucket", "Value": false } ] }, { "Id": "LoggingS3KeyPrefix", "Name": "Logging S3 Key Prefix", "Description": "Optional S3 key prefix to store access logs (e.g. app-name/)", "Type": "String", "DefaultValue": null, "AdvancedSetting": true, "Updatable": true, "DependsOn": [ { "Id": "AccessLogging.Enable", "Value": true } ] } ] }, { "Id": "PriceClass", "Name": "CloudFront Price Class", "Category": "General", "Description": "Configure the edge locations that will respond to request for the CloudFront distribution", "Type": "String", "DefaultValue": "PRICE_CLASS_ALL", "AllowedValues": [ "PRICE_CLASS_100", "PRICE_CLASS_200", "PRICE_CLASS_ALL" ], "ValueMapping": { "PRICE_CLASS_100": "North America and Europe edge locations", "PRICE_CLASS_200": "North America, Europe, Asia, Middle East, and Africa edge locations", "PRICE_CLASS_ALL": "All edge locations (best performance)" }, "AdvancedSetting": true, "Updatable": true }, { "Id": "EnableIpv6", "Name": "Enable IPv6", "Category": "Networking", "Description": "Control if IPv6 should be enabled for the CloudFront distribution", "Type": "Bool", "DefaultValue": true, "AdvancedSetting": true, "Updatable": true }, { "Id": "MaxHttpVersion", "Name": "Maximum HTTP Version", "Category": "Networking", "Description": "The maximum http version that users can use to communicate with the CloudFront distribution", "Type": "String", "DefaultValue": "HTTP2_AND_3", "AllowedValues": [ "HTTP2_AND_3", "HTTP3","HTTP2", "HTTP1_1" ], "ValueMapping": { "HTTP2_AND_3": "HTTP 2 and 3", "HTTP3": "HTTP 3", "HTTP2": "HTTP 2", "HTTP1_1": "HTTP 1.1" }, "AdvancedSetting": true, "Updatable": true }, { "Id": "WebAclId", "Name": "Web ACL Arn", "Category": "Networking", "Description": "The AWS WAF (web application firewall) ACL arn", "Type": "String", "DefaultValue": null, "AdvancedSetting": true, "Updatable": true } ] }