AWSTemplateFormatVersion: '2010-09-09' Resources: HelloHandlerServiceRole11EF7C63: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: lambda.amazonaws.com Version: "2012-10-17" ManagedPolicyArns: - Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole Metadata: aws:cdk:path: CdkWorkshopStack/HelloHandler/ServiceRole/Resource HelloHandler2E4FBA4D: Type: AWS::Lambda::Function Properties: Code: '.' Handler: main.handler Runtime: python3.9 Timeout: 600 HelloHandlerApiPermissionANYAC4E141E: Type: AWS::Lambda::Permission Properties: Action: lambda:InvokeFunction FunctionName: Ref: HelloHandler2E4FBA4D Principal: apigateway.amazonaws.com SourceArn: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":execute-api:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - ":" - Ref: EndpointEEF1FD8F - / - Ref: EndpointDeploymentStageprodB78BEEA0 - /*/ Metadata: aws:cdk:path: CdkWorkshopStack/HelloHandler/ApiPermission.ANY.. HelloHandlerApiPermissionTestANYDDD56D72: Type: AWS::Lambda::Permission Properties: Action: lambda:InvokeFunction FunctionName: Ref: HelloHandler2E4FBA4D Principal: apigateway.amazonaws.com SourceArn: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":execute-api:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - ":" - Ref: EndpointEEF1FD8F - /test-invoke-stage/*/ Metadata: aws:cdk:path: CdkWorkshopStack/HelloHandler/ApiPermission.Test.ANY.. HelloHandlerApiPermissionANYproxy90E90CD6: Type: AWS::Lambda::Permission Properties: Action: lambda:InvokeFunction FunctionName: Ref: HelloHandler2E4FBA4D Principal: apigateway.amazonaws.com SourceArn: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":execute-api:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - ":" - Ref: EndpointEEF1FD8F - / - Ref: EndpointDeploymentStageprodB78BEEA0 - /*/{proxy+} Metadata: aws:cdk:path: CdkWorkshopStack/HelloHandler/ApiPermission.ANY..{proxy+} HelloHandlerApiPermissionTestANYproxy9803526C: Type: AWS::Lambda::Permission Properties: Action: lambda:InvokeFunction FunctionName: Ref: HelloHandler2E4FBA4D Principal: apigateway.amazonaws.com SourceArn: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":execute-api:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - ":" - Ref: EndpointEEF1FD8F - /test-invoke-stage/*/{proxy+} Metadata: aws:cdk:path: CdkWorkshopStack/HelloHandler/ApiPermission.Test.ANY..{proxy+} EndpointEEF1FD8F: Type: AWS::ApiGateway::RestApi Properties: Name: Endpoint Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/Resource EndpointDeployment318525DA37c0e38727e25b4317827bf43e918fbf: Type: AWS::ApiGateway::Deployment Properties: RestApiId: Ref: EndpointEEF1FD8F Description: Automatically created by the RestApi construct DependsOn: - Endpointproxy39E2174E - EndpointANY485C938B - EndpointproxyANYC09721C5 Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/Deployment/Resource EndpointDeploymentStageprodB78BEEA0: Type: AWS::ApiGateway::Stage Properties: RestApiId: Ref: EndpointEEF1FD8F DeploymentId: Ref: EndpointDeployment318525DA37c0e38727e25b4317827bf43e918fbf StageName: prod Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/DeploymentStage.prod/Resource EndpointCloudWatchRoleC3C64E0F: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: apigateway.amazonaws.com Version: "2012-10-17" ManagedPolicyArns: - Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - :iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/CloudWatchRole/Resource EndpointAccountB8304247: Type: AWS::ApiGateway::Account Properties: CloudWatchRoleArn: Fn::GetAtt: - EndpointCloudWatchRoleC3C64E0F - Arn DependsOn: - EndpointEEF1FD8F Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/Account Endpointproxy39E2174E: Type: AWS::ApiGateway::Resource Properties: ParentId: Fn::GetAtt: - EndpointEEF1FD8F - RootResourceId PathPart: "{proxy+}" RestApiId: Ref: EndpointEEF1FD8F Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/{proxy+}/Resource EndpointproxyANYC09721C5: Type: AWS::ApiGateway::Method Properties: HttpMethod: ANY ResourceId: Ref: Endpointproxy39E2174E RestApiId: Ref: EndpointEEF1FD8F AuthorizationType: NONE Integration: IntegrationHttpMethod: POST Type: AWS_PROXY Uri: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":apigateway:" - Ref: AWS::Region - :lambda:path/2015-03-31/functions/ - Fn::GetAtt: - HelloHandler2E4FBA4D - Arn - /invocations Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/{proxy+}/ANY/Resource EndpointANY485C938B: Type: AWS::ApiGateway::Method Properties: HttpMethod: ANY ResourceId: Fn::GetAtt: - EndpointEEF1FD8F - RootResourceId RestApiId: Ref: EndpointEEF1FD8F AuthorizationType: NONE Integration: IntegrationHttpMethod: POST Type: AWS_PROXY Uri: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":apigateway:" - Ref: AWS::Region - :lambda:path/2015-03-31/functions/ - Fn::GetAtt: - HelloHandler2E4FBA4D - Arn - /invocations Metadata: aws:cdk:path: CdkWorkshopStack/Endpoint/ANY/Resource CDKMetadata: Type: AWS::CDK::Metadata Properties: Modules: aws-cdk=0.22.0,jsii-runtime=node.js/v12.4.0 Parameters: HelloHandlerCodeS3Bucket4359A483: Type: String Description: S3 bucket for asset "CdkWorkshopStack/HelloHandler/Code" HelloHandlerCodeS3VersionKey07D12610: Type: String Description: S3 key for asset version "CdkWorkshopStack/HelloHandler/Code" Outputs: Endpoint8024A810: Value: Fn::Join: - "" - - https:// - Ref: EndpointEEF1FD8F - .execute-api. - Ref: AWS::Region - "." - Ref: AWS::URLSuffix - / - Ref: EndpointDeploymentStageprodB78BEEA0 - / Export: Name: CdkWorkshopStack:Endpoint8024A810