{ "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "", "Parameters" : { "GitHubOwner" : { "Type" : "String", "Default" : "aws-samples", "Description" : "GitHub repository owner" }, "GitHubRepo" : { "Type" : "String", "Default" : "dotnet-serverless-imagerecognition", "Description" : "GitHub repository name" }, "GitHubBranch" : { "Type" : "String", "Default" : "main", "Description" : "GitHub repository branch" }, "GitHubToken" : { "Type" : "String", "Default": "", "Description" : "GitHub repository OAuth token" } }, "Resources" : { "CodePipelineRole":{ "Type":"AWS::IAM::Role", "Properties":{ "AssumeRolePolicyDocument":{ "Statement":[ { "Effect":"Allow", "Principal":{ "Service":[ "codepipeline.amazonaws.com" ] }, "Action":[ "sts:AssumeRole" ] } ] }, "Path":"/", "ManagedPolicyArns" : [ "arn:aws:iam::aws:policy/AWSCodeBuildDeveloperAccess", "arn:aws:iam::aws:policy/AdministratorAccess" ], "Policies":[ { "PolicyName":"codepipeline-service", "PolicyDocument":{ "Statement":[ { "Action":[ "codecommit:GetBranch", "codecommit:GetCommit", "codecommit:UploadArchive", "codecommit:GetUploadArchiveStatus", "codecommit:CancelUploadArchive" ], "Resource":"*", "Effect":"Allow" } ], "Version":"2012-10-17" } } ] } }, "CodeBuildRole" : { "Type" : "AWS::IAM::Role", "Properties" : { "AssumeRolePolicyDocument" : { "Statement":[ { "Effect":"Allow", "Principal":{ "Service":[ "codebuild.amazonaws.com" ] }, "Action":[ "sts:AssumeRole" ] } ] }, "ManagedPolicyArns" : [ "arn:aws:iam::aws:policy/PowerUserAccess" ] } }, "CloudFormationRole" : { "Type" : "AWS::IAM::Role", "Properties" : { "AssumeRolePolicyDocument" : { "Statement":[ { "Effect":"Allow", "Principal":{ "Service":[ "cloudformation.amazonaws.com" ] }, "Action":[ "sts:AssumeRole" ] } ] }, "ManagedPolicyArns" : [ "arn:aws:iam::aws:policy/AdministratorAccess" ] } }, "ImageRecognitionArtifactStore" : { "Type" : "AWS::S3::Bucket", "Properties" : { } }, "BlazorWASMBucket": { "Type": "AWS::S3::Bucket", "Description": "", "DeletionPolicy": "Delete" }, "ParameterBlazorS3BucketName": { "Type": "AWS::SSM::Parameter", "Description": "Stores the connection ids for the websocket connections made in the client.", "Properties": { "Type": "String", "Value": { "Ref": "BlazorWASMBucket" }, "Name": "/ImageRecognition/AWS/BlazorS3BucketName" } }, "ParameterImageRecognitionArtifactStore" : { "Type" : "AWS::SSM::Parameter", "Properties" : { "Type" : "String", "Value" : {"Ref" : "ImageRecognitionArtifactStore"}, "Name" : "/ImageRecognition/ImageRecognitionArtifactStore" } }, "S3TriggerLambdaFunctionBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-S3TriggerLambdaFunctionBuild" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_MEDIUM", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/amazonlinux2-x86_64-standard:4.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/s3Trigger/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "ImageRecognitionStepFunctionsBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-ImageRecognitionStepFunctions" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_LARGE", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/amazonlinux2-x86_64-standard:4.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/StepFunctions/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "PhotoCommunicationsBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-Communications" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_MEDIUM", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/standard:5.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/Communication/ImageRecognition.Communication.Functions/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "ImageRecognitionAPIBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-API" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_MEDIUM", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/standard:6.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/API/ImageRecognition.API/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "ImageRecognitionAuthAPIBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-OAuthProxy" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_MEDIUM", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/amazonlinux2-x86_64-standard:4.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/API/OAuth/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "ImageRecognitionWASMBuild" : { "Type" : "AWS::CodeBuild::Project", "Properties" : { "Artifacts" : { "Type" : "CODEPIPELINE" }, "Name" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-BlazorWASM" ] ]}, "ServiceRole" : { "Ref" : "CodeBuildRole" }, "Environment" : { "ComputeType" : "BUILD_GENERAL1_MEDIUM", "Type" : "LINUX_CONTAINER", "Image" : "aws/codebuild/amazonlinux2-x86_64-standard:4.0", "PrivilegedMode" : true }, "Source" : { "BuildSpec" : "Application/UI/Blazor/ImageRecognition.BlazorWebAssembly/buildspec.yml", "Type" : "CODEPIPELINE" } } }, "Pipeline" : { "Type" : "AWS::CodePipeline::Pipeline", "Properties" : { "ArtifactStore" : { "Location" : { "Ref" : "ImageRecognitionArtifactStore" }, "Type" : "S3" }, "RoleArn" : {"Fn::GetAtt" : [ "CodePipelineRole", "Arn"]}, "Stages" : [ { "Name" : "Source", "Actions" : [ { "Name": "GitHub", "ActionTypeId": { "Category": "Source", "Version": "1", "Owner": "ThirdParty", "Provider": "GitHub" }, "Configuration": { "Owner": { "Ref": "GitHubOwner" }, "Repo": { "Ref": "GitHubRepo" }, "Branch": { "Ref": "GitHubBranch" }, "OAuthToken": { "Ref": "GitHubToken" } }, "InputArtifacts": [ ], "OutputArtifacts": [ { "Name": "TheSource" } ], "RunOrder": 1 } ] }, { "Name" : "ImageRecognition-Infrastructure", "Actions" : [ { "Name" : "CF-ImageRecognition-Infrastructure", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-Infrastructure" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "TheSource::Application/CloudFormationTemplates/imagerecognition-resources.template" }, "RunOrder" : 1 } ] }, { "Name" : "ImageRecognition-OAuthProxy", "Actions" : [ { "Name" : "Build-OAuthProxy", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "ImageRecognitionAuthAPIBuild" } ], "Configuration" : { "ProjectName" : { "Ref" : "ImageRecognitionAuthAPIBuild" } }, "RunOrder" : 1 }, { "Name" : "CF-OAuthProxyAPI", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "ImageRecognitionAuthAPIBuild" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-OAuthProxy" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "ImageRecognitionAuthAPIBuild::updated.template" }, "RunOrder" : 2 } ] }, { "Name" : "Photo-Communications", "Actions" : [ { "Name" : "Build-Communications", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "PhotoCommunicationsBundle" } ], "Configuration" : { "ProjectName" : { "Ref" : "PhotoCommunicationsBuild" } }, "RunOrder" : 1 }, { "Name" : "CF-PhotoCommunications", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "PhotoCommunicationsBundle" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-Communications" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "PhotoCommunicationsBundle::updated.template" }, "RunOrder" : 2 } ] }, { "Name" : "ImageRecognition-Render-Step-Function", "Actions" : [ { "Name" : "Build-ImageRecognitionStepFunctions", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "ImageRecognitionStepFunctionsBundle" } ], "Configuration" : { "ProjectName" : { "Ref" : "ImageRecognitionStepFunctionsBuild" } }, "RunOrder" : 1 }, { "Name" : "CF-ImageRecognitionStepFunctions", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "ImageRecognitionStepFunctionsBundle" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-StepFunctions" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "ImageRecognitionStepFunctionsBundle::updated.template" }, "RunOrder" : 2 } ] }, { "Name" : "ImageRecognition-S3Trigger-LambdaFunction", "Actions" : [ { "Name" : "Build-S3TriggerLambdaFunctions", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "S3TriggerLambdaFunctionBuild" } ], "Configuration" : { "ProjectName" : { "Ref" : "S3TriggerLambdaFunctionBuild" } }, "RunOrder" : 1 }, { "Name" : "CF-S3TriggerLambdaFunction", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "S3TriggerLambdaFunctionBuild" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-S3TriggerLambdaFunction" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "S3TriggerLambdaFunctionBuild::updated.template" }, "RunOrder" : 2 } ] }, { "Name" : "ImageRecognition-API", "Actions" : [ { "Name" : "Build-API", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "ImageRecognitionAPIBundle" } ], "Configuration" : { "ProjectName" : { "Ref" : "ImageRecognitionAPIBuild" } }, "RunOrder" : 1 }, { "Name" : "CF-ImageRecognitionAPI", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "CloudFormation", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "ImageRecognitionAPIBundle" } ], "Configuration" : { "ActionMode" : "CREATE_UPDATE", "StackName" : {"Fn::Join" : [ "", [{ "Ref" : "AWS::StackName" }, "-API" ] ]}, "Capabilities" : "CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND", "RoleArn" : {"Fn::GetAtt" : [ "CloudFormationRole", "Arn"]}, "TemplatePath" : "ImageRecognitionAPIBundle::updated.template" }, "RunOrder" : 2 } ] }, { "Name" : "ImageRecognition-BlazorFrontend", "Actions" : [ { "Name" : "Build-BlazorFrontend", "ActionTypeId" : { "Category" : "Build", "Provider" : "CodeBuild", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "TheSource" } ], "OutputArtifacts" : [ { "Name" : "ImageRecognitionBlazorBundle" } ], "Configuration" : { "ProjectName" : { "Ref" : "ImageRecognitionWASMBuild" } }, "RunOrder" : 1 }, { "Name" : "Create-S3StaticFile", "ActionTypeId" : { "Category" : "Deploy", "Provider" : "S3", "Owner" : "AWS", "Version" : "1" }, "InputArtifacts" : [ { "Name" : "ImageRecognitionBlazorBundle" } ], "Configuration" : { "BucketName": { "Ref" : "BlazorWASMBucket" }, "Extract": "true" }, "RunOrder" : 2 } ] } ] } } }, "Outputs" : { } }