# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 AWSTemplateFormatVersion: 2010-09-09 Description: EMR Serverless full deployment stack Resources: # S3 Bucket for logs EMRServerlessLogBucket: Type: AWS::S3::Bucket # IAM resources EMRServerlessJobRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - emr-serverless.amazonaws.com Action: - 'sts:AssumeRole' Description: "Service role for EMR Studio" RoleName: EMRServerless_Job_Execution_Role Policies: - PolicyName: GlueAccess PolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: - "glue:GetDatabase" - "glue:GetDataBases" - "glue:CreateTable" - "glue:GetTable" - "glue:GetTables" - "glue:GetPartition" - "glue:GetPartitions" - "glue:CreatePartition" - "glue:BatchCreatePartition" - "glue:GetUserDefinedFunctions" Resource: '*' - PolicyName: S3Access PolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: - "s3:GetObject" - "s3:ListBucket" Resource: '*' - Effect: Allow Action: - "s3:PutObject" - "s3:DeleteObject" Resource: - !Sub 'arn:aws:s3:::${EMRServerlessLogBucket}/*' SparkApplication: Type: AWS::EMRServerless::Application Properties: Name: spark-3.2 ReleaseLabel: emr-6.6.0 Type: Spark MaximumCapacity: Cpu: 200 vCPU Memory: 100 GB AutoStartConfiguration: Enabled: true AutoStopConfiguration: Enabled: true IdleTimeoutMinutes: 100 InitialCapacity: - Key: Driver Value: WorkerCount: 3 WorkerConfiguration: Cpu: 2 vCPU Memory: 4 GB Disk: 21 GB - Key: Executor Value: WorkerCount: 4 WorkerConfiguration: Cpu: 1 vCPU Memory: 4 GB Disk: 20 GB Tags: - Key: tag-on-create-key Value: tag-on-create-value Outputs: ApplicationId: Value: !Ref SparkApplication ApplicationArn: Value: !GetAtt SparkApplication.Arn JobRoleArn: Value: !GetAtt EMRServerlessJobRole.Arn S3Bucket: Value: !Ref EMRServerlessLogBucket