From 44f6d142f4cb9a51dc9d57f380033be7a050377e Mon Sep 17 00:00:00 2001 From: sbx_user1051 Date: Fri, 27 Sep 2024 16:46:33 +0000 Subject: [PATCH] Add AWS Cloudformation Deployment file for poseidon-new-stack stack --- deploy/aws/template.yaml | 108 ++------------------------------------- 1 file changed, 3 insertions(+), 105 deletions(-) diff --git a/deploy/aws/template.yaml b/deploy/aws/template.yaml index 5e7c3445..66156476 100644 --- a/deploy/aws/template.yaml +++ b/deploy/aws/template.yaml @@ -1,105 +1,3 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: AWS::Serverless-2016-10-31 -Description: > - PoseidonExecutors - - Execute untrusted code in AWS functions. - -# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst -Globals: - Function: - Timeout: 15 - -Resources: - PoseidonExecWebSocket: - Type: AWS::ApiGatewayV2::Api - Properties: - Name: PoseidonExecWebSocket - ProtocolType: WEBSOCKET - RouteSelectionExpression: "$request.body.action" - - Deployment: - Type: AWS::ApiGatewayV2::Deployment - DependsOn: - - java11ExecRoute - Properties: - ApiId: !Ref PoseidonExecWebSocket - - Stage: - Type: AWS::ApiGatewayV2::Stage - Properties: - StageName: production - Description: Production Stage - DeploymentId: !Ref Deployment - ApiId: !Ref PoseidonExecWebSocket - - java11ExecRoute: # More info about Routes: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-route.html - Type: AWS::ApiGatewayV2::Route - Properties: - ApiId: !Ref PoseidonExecWebSocket - RouteKey: java11Exec - AuthorizationType: NONE - OperationName: java11ExecRoute - Target: !Join - - '/' - - - 'integrations' - - !Ref java11ExecInteg - - java11ExecInteg: # More info about Integrations: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html - Type: AWS::ApiGatewayV2::Integration - Properties: - ApiId: !Ref PoseidonExecWebSocket - Description: Java 11 Exec Integration - IntegrationType: AWS_PROXY - IntegrationUri: - Fn::Sub: - arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${java11ExecFunction.Arn}/invocations - - java11ExecFunction: - Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction - Properties: - CodeUri: java11Exec/ - Handler: poseidon.App::handleRequest - Runtime: java11 - Architectures: - - arm64 - MemorySize: 2048 - Policies: - - Statement: - - Effect: Allow - Action: - - 'execute-api:*' - Resource: "*" - - Effect: Allow - Action: - - 'logs:CreateLogGroup' - Resource: - - !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:*' - - Effect: Allow - Action: - - 'logs:CreateLogStream' - - 'logs:PutLogEvents' - Resource: - - !Sub 'arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:${PoseidonExecWebSocket}:*' - - java11ExecPermission: - Type: AWS::Lambda::Permission - DependsOn: - - PoseidonExecWebSocket - Properties: - Action: lambda:InvokeFunction - FunctionName: !Ref java11ExecFunction - Principal: apigateway.amazonaws.com - -Outputs: - WebSocketURI: - Description: "The WSS Protocol URI to connect to" - Value: !Join [ '', [ 'wss://', !Ref PoseidonExecWebSocket, '.execute-api.',!Ref 'AWS::Region','.amazonaws.com/',!Ref 'Stage' ] ] - - java11ExecFunctionArn: - Description: "Java 11 Execution Lambda Function ARN" - Value: !GetAtt java11ExecFunction.Arn - - java11ExecFunctionIamRole: - Description: "Implicit IAM Role created for the Java 11 Execution function" - Value: !GetAtt java11ExecFunctionRole.Arn +template-file-path: deploy/aws/template.yaml +parameters: {} +tags: {}