Parameters: C9InstanceType: Description: Cloud9 instance type Type: String Default: m5.large AllowedValues: - t3.small - t3.medium - m4.large - m5.large ConstraintDescription: Must be a valid Cloud9 instance type # Used only by Event Engine, if you are self-deploying the stack leave the default value to NONE EETeamRoleArn: Description: "ARN of the Team Role" Default: NONE Type: String ConstraintDescription: This is ONLY used Event Engine, don't change this if you are self-deploying the stack Resources: CustomCloud9SsmCloud9Ec2EnvironmentF47DD48C: Type: AWS::Cloud9::EnvironmentEC2 Properties: InstanceType: Ref: C9InstanceType Tags: - Key: stack-id Value: Ref: AWS::StackId OwnerArn: !If [NotEventEngine , !Ref AWS::NoValue , !Sub 'arn:aws:sts::${AWS::AccountId}:assumed-role/TeamRole/MasterKey'] Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/Cloud9Ec2Environment CustomCloud9SsmEc2RoleCE9ACBCB: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: Fn::Join: - "" - - ec2. - Ref: AWS::URLSuffix Version: "2012-10-17" ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore RoleName: CustomCloud9Ssm-CustomCloud9SsmEc2Role Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/Ec2Role/Resource CustomCloud9SsmEc2RoleDefaultPolicy92A07C4C: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: - ec2:DescribeInstances - ec2:ModifyVolume - ec2:DescribeVolumesModifications - batch:DescribeJobQueues - batch:CreateComputeEnvironment - batch:DeleteComputeEnvironment - batch:SubmitJob - batch:UpdateComputeEnvironment - batch:ListJobs - batch:ListJobs - ecr:* - batch:DescribeComputeEnvironments - cloudformation:DescribeStacks - batch:DeregisterJobDefinition - s3:PutObject - s3:ListBucket - s3:DeleteObject - batch:CreateJobQueue - batch:DescribeJobs - batch:RegisterJobDefinition - states:StartExecution - batch:DescribeJobDefinitions - batch:DeleteJobQueue - batch:UpdateJobQueue - iam:PassRole Effect: Allow Resource: "*" Version: "2012-10-17" PolicyName: CustomCloud9SsmEc2RoleDefaultPolicy92A07C4C Roles: - Ref: CustomCloud9SsmEc2RoleCE9ACBCB Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/Ec2Role/DefaultPolicy/Resource CustomCloud9SsmEc2InstanceProfile167B6BF8: Type: AWS::IAM::InstanceProfile Properties: Roles: - Ref: CustomCloud9SsmEc2RoleCE9ACBCB DependsOn: - CustomCloud9SsmEc2RoleDefaultPolicy92A07C4C - CustomCloud9SsmEc2RoleCE9ACBCB Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/Ec2InstanceProfile CustomCloud9SsmSsmDocumentD052D5F9: Type: AWS::SSM::Document Properties: Content: schemaVersion: "2.2" description: Bootstrap Cloud9 EC2 instance mainSteps: - name: ResizeEBS action: aws:runShellScript inputs: runCommand: - "#!/bin/bash" - echo '=== Installing packages ===' - sudo yum -y install jq - sudo pip install boto3 - echo '=== Exporting current region ===' - export AWS_DEFAULT_REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region') - echo 'Region is ${AWS_DEFAULT_REGION}' - echo '=== Gathering instance Id ===' - instanceId=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.instanceId') - echo 'Instance Id is ${instanceId}' - echo '=== Resizing EBS volume ===' - volumeId=$(aws ec2 describe-instances --instance-ids $instanceId | jq -r '.Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId') - echo 'Volume Id is ${volumeId}' - aws ec2 modify-volume --volume-id $volumeId --size 100 - echo '=== Waiting for the volume to enter the optimizing state ===' - while [ true ] - do - modificationState=$(aws ec2 describe-volumes-modifications --volume-ids $volumeId | jq -r '.VolumesModifications[0].ModificationState') - if [ $modificationState == "optimizing" ] ; then - break - fi - sleep 5 - done - echo '=== Resizing file system ===' - sudo growpart /dev/xvda 1 - sudo resize2fs $(df -h |awk '/^\/dev/{print $1}') DocumentType: Command Name: CustomCloud9Ssm-CustomCloudSsm-SsmDocument Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/SsmDocument CustomCloud9SsmSsmAssociationABF443F9: Type: AWS::SSM::Association Properties: Name: CustomCloud9Ssm-CustomCloudSsm-SsmDocument Targets: - Key: tag:stack-id Values: - Ref: AWS::StackId DependsOn: - CustomCloud9SsmCloud9Ec2EnvironmentF47DD48C - CustomCloud9SsmSsmDocumentD052D5F9 Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/SsmAssociation CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleF610D074: 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: RenderingStack/CustomCloud9Ssm/ProfileAttachLambdaFunction/ServiceRole/Resource CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleDefaultPolicy9CC20561: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: - ec2:DescribeInstances - ec2:AssociateIamInstanceProfile - ec2:ReplaceIamInstanceProfileAssociation - ec2:RebootInstances - iam:ListInstanceProfiles - iam:PassRole - ssm:DescribeAssociationExecutions - ssm:DescribeAssociationExecutionTargets Effect: Allow Resource: "*" Version: "2012-10-17" PolicyName: CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleDefaultPolicy9CC20561 Roles: - Ref: CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleF610D074 Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/ProfileAttachLambdaFunction/ServiceRole/DefaultPolicy/Resource CustomCloud9SsmProfileAttachLambdaFunction01DB4FFC: Type: AWS::Lambda::Function Properties: Code: ZipFile: | import boto3 import cfnresponse import time def is_association_applied(association_id): client = boto3.client('ssm') # Retrieve the execution history of the association response = client.describe_association_executions( AssociationId=association_id, Filters=[ { 'Key': 'Status', 'Value': 'Success', 'Type': 'EQUAL' } ] ) # There are no executions yet if 'AssociationExecutions' not in response or not response['AssociationExecutions']: return False # Retrieve the targets of the execution to see if the SSM agent has picked up the EC2 instance yet response = client.describe_association_execution_targets( AssociationId=association_id, ExecutionId=response['AssociationExecutions'][0]['ExecutionId'], Filters=[ { 'Key': 'Status', 'Value': 'Success' } ] ) return 'AssociationExecutionTargets' in response and response['AssociationExecutionTargets'] def handler(event, context): if event['RequestType'] == 'Create': # Extract context variables stack_id = event['ResourceProperties']['stack_id'] profile_arn = event['ResourceProperties']['profile_arn'] association_id = event['ResourceProperties']['association_id'] try: client = boto3.client('ec2') # Retrieve EC2 instance's identifier print('Retrieving EC2 instance Id') instance_id = client.describe_instances( Filters=[{'Name': 'tag:stack-id', 'Values': [stack_id]}] )['Reservations'][0]['Instances'][0]['InstanceId'] # Associate the SSM instance profile print('Associating the SSM instance profile to the instance') client.associate_iam_instance_profile( IamInstanceProfile={'Arn': profile_arn}, InstanceId=instance_id ) # Reboot the instance to restart the SSM agent print('Rebooting the instance so that the SSM agent picks up the association') client.reboot_instances( InstanceIds=[instance_id] ) # Wait for the SSM association to be applied while True: print('Waiting for the association to be applied') if is_association_applied(association_id): break else: time.sleep(5) except Exception as e: cfnresponse.send(event, context, cfnresponse.FAILED, {'Error': e.args[0]}) return cfnresponse.send(event, context, cfnresponse.SUCCESS, {}) Role: Fn::GetAtt: - CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleF610D074 - Arn Handler: index.handler Runtime: python3.9 Timeout: 800 DependsOn: - CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleDefaultPolicy9CC20561 - CustomCloud9SsmProfileAttachLambdaFunctionServiceRoleF610D074 Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/ProfileAttachLambdaFunction/Resource CustomCloud9SsmCustomResourceCD940758: Type: AWS::CloudFormation::CustomResource Properties: ServiceToken: Fn::GetAtt: - CustomCloud9SsmProfileAttachLambdaFunction01DB4FFC - Arn stack_id: Ref: AWS::StackId profile_arn: Fn::GetAtt: - CustomCloud9SsmEc2InstanceProfile167B6BF8 - Arn association_id: Fn::GetAtt: - CustomCloud9SsmSsmAssociationABF443F9 - AssociationId DependsOn: - CustomCloud9SsmEc2InstanceProfile167B6BF8 - CustomCloud9SsmSsmAssociationABF443F9 UpdateReplacePolicy: Delete DeletionPolicy: Delete Metadata: aws:cdk:path: RenderingStack/CustomCloud9Ssm/CustomResource/Default FISCustomRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: - fis.amazonaws.com Action: - sts:AssumeRole Path: "/" Policies: - PolicyName: AllowFISExperimentRoleActions PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - 'ec2:SendSpotInstanceInterruptions' Resource: !Sub 'arn:aws:ec2:${AWS::Region}:${AWS::AccountId}:instance/*' RoleName: FIS-Custom-Role Vpc8378EB38: Type: AWS::EC2::VPC Properties: CidrBlock: 10.0.0.0/16 EnableDnsHostnames: true EnableDnsSupport: true InstanceTenancy: default Tags: - Key: Name Value: RenderingStack/Vpc Metadata: aws:cdk:path: RenderingStack/Vpc/Resource VpcRenderingWithBatchSubnet1SubnetADE6DAA0: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.0.0.0/24 VpcId: Ref: Vpc8378EB38 AvailabilityZone: Fn::Select: - 0 - Fn::GetAZs: "" MapPublicIpOnLaunch: true Tags: - Key: aws-cdk:subnet-name Value: RenderingWithBatch - Key: aws-cdk:subnet-type Value: Public - Key: Name Value: RenderingStack/Vpc/RenderingWithBatchSubnet1 Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet1/Subnet VpcRenderingWithBatchSubnet1RouteTable1BCC3903: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: Vpc8378EB38 Tags: - Key: Name Value: RenderingStack/Vpc/RenderingWithBatchSubnet1 Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet1/RouteTable VpcRenderingWithBatchSubnet1RouteTableAssociation9592115F: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VpcRenderingWithBatchSubnet1RouteTable1BCC3903 SubnetId: Ref: VpcRenderingWithBatchSubnet1SubnetADE6DAA0 Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet1/RouteTableAssociation VpcRenderingWithBatchSubnet1DefaultRoute58E16100: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VpcRenderingWithBatchSubnet1RouteTable1BCC3903 DestinationCidrBlock: 0.0.0.0/0 GatewayId: Ref: VpcIGWD7BA715C DependsOn: - VpcVPCGWBF912B6E Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet1/DefaultRoute VpcRenderingWithBatchSubnet2SubnetDC61207B: Type: AWS::EC2::Subnet Properties: CidrBlock: 10.0.1.0/24 VpcId: Ref: Vpc8378EB38 AvailabilityZone: Fn::Select: - 1 - Fn::GetAZs: "" MapPublicIpOnLaunch: true Tags: - Key: aws-cdk:subnet-name Value: RenderingWithBatch - Key: aws-cdk:subnet-type Value: Public - Key: Name Value: RenderingStack/Vpc/RenderingWithBatchSubnet2 Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet2/Subnet VpcRenderingWithBatchSubnet2RouteTable5DF00176: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: Vpc8378EB38 Tags: - Key: Name Value: RenderingStack/Vpc/RenderingWithBatchSubnet2 Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet2/RouteTable VpcRenderingWithBatchSubnet2RouteTableAssociationE3297937: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: Ref: VpcRenderingWithBatchSubnet2RouteTable5DF00176 SubnetId: Ref: VpcRenderingWithBatchSubnet2SubnetDC61207B Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet2/RouteTableAssociation VpcRenderingWithBatchSubnet2DefaultRoute42CB5476: Type: AWS::EC2::Route Properties: RouteTableId: Ref: VpcRenderingWithBatchSubnet2RouteTable5DF00176 DestinationCidrBlock: 0.0.0.0/0 GatewayId: Ref: VpcIGWD7BA715C DependsOn: - VpcVPCGWBF912B6E Metadata: aws:cdk:path: RenderingStack/Vpc/RenderingWithBatchSubnet2/DefaultRoute VpcIGWD7BA715C: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Name Value: RenderingStack/Vpc Metadata: aws:cdk:path: RenderingStack/Vpc/IGW VpcVPCGWBF912B6E: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: Ref: Vpc8378EB38 InternetGatewayId: Ref: VpcIGWD7BA715C Metadata: aws:cdk:path: RenderingStack/Vpc/VPCGW securityGroup32C48086: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: RenderingStack/securityGroup GroupName: RenderingWithBatch SecurityGroupEgress: - CidrIp: 0.0.0.0/0 Description: Allow all outbound traffic by default IpProtocol: "-1" VpcId: Ref: Vpc8378EB38 DependsOn: - VpcIGWD7BA715C - VpcRenderingWithBatchSubnet1DefaultRoute58E16100 - VpcRenderingWithBatchSubnet1RouteTable1BCC3903 - VpcRenderingWithBatchSubnet1RouteTableAssociation9592115F - VpcRenderingWithBatchSubnet1SubnetADE6DAA0 - VpcRenderingWithBatchSubnet2DefaultRoute42CB5476 - VpcRenderingWithBatchSubnet2RouteTable5DF00176 - VpcRenderingWithBatchSubnet2RouteTableAssociationE3297937 - VpcRenderingWithBatchSubnet2SubnetDC61207B - Vpc8378EB38 - VpcVPCGWBF912B6E Metadata: aws:cdk:path: RenderingStack/securityGroup/Resource launchTemplateDEE5742D: Type: AWS::EC2::LaunchTemplate Properties: LaunchTemplateData: SecurityGroupIds: - Fn::GetAtt: - securityGroup32C48086 - GroupId TagSpecifications: - ResourceType: instance Tags: - Key: Name Value: RenderingStack/launchTemplate - ResourceType: volume Tags: - Key: Name Value: RenderingStack/launchTemplate UserData: Fn::Base64: |- MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" --==MYBOUNDARY== Content-Type: text/x-shellscript; charset="us-ascii" #!/bin/bash echo "ECS_CLUSTER=EcsSpotWorkshop" >> /etc/ecs/ecs.config echo "ECS_ENABLE_SPOT_INSTANCE_DRAINING=true" >> /etc/ecs/ecs.config echo "ECS_CONTAINER_STOP_TIMEOUT=90s" >> /etc/ecs/ecs.config echo "ECS_ENABLE_CONTAINER_METADATA=true" >> /etc/ecs/ecs.config --==MYBOUNDARY==-- LaunchTemplateName: RenderingWithBatch DependsOn: - securityGroup32C48086 Metadata: aws:cdk:path: RenderingStack/launchTemplate/Resource repository9F1A3F0B: Type: AWS::ECR::Repository Properties: RepositoryName: rendering-with-batch UpdateReplacePolicy: Delete DeletionPolicy: Delete Metadata: aws:cdk:path: RenderingStack/repository/Resource ecsRole157644C0: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: Fn::Join: - "" - - ec2. - Ref: AWS::URLSuffix Version: "2012-10-17" ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonS3FullAccess - arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role Metadata: aws:cdk:path: RenderingStack/ecsRole/Resource ecsinstanceprofile: Type: AWS::IAM::InstanceProfile Properties: Roles: - Ref: ecsRole157644C0 DependsOn: - ecsRole157644C0 Metadata: aws:cdk:path: RenderingStack/ecsinstanceprofile bucket43879C71: Type: AWS::S3::Bucket UpdateReplacePolicy: Delete DeletionPolicy: Delete Metadata: aws:cdk:path: RenderingStack/bucket/Resource PreprocessingServiceRole532E6474: 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 DependsOn: - bucket43879C71 Metadata: aws:cdk:path: RenderingStack/Preprocessing/ServiceRole/Resource PreprocessingServiceRoleDefaultPolicyF8800D5C: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: "*" Effect: Allow Resource: - Fn::GetAtt: - bucket43879C71 - Arn - Fn::Join: - "" - - Fn::GetAtt: - bucket43879C71 - Arn - /* Version: "2012-10-17" PolicyName: PreprocessingServiceRoleDefaultPolicyF8800D5C Roles: - Ref: PreprocessingServiceRole532E6474 DependsOn: - bucket43879C71 Metadata: aws:cdk:path: RenderingStack/Preprocessing/ServiceRole/DefaultPolicy/Resource Preprocessing329E01E4: Type: AWS::Lambda::Function Properties: Code: ZipFile: | import json, gzip, struct, boto3, math, sys # ##### BEGIN GPL LICENSE BLOCK ##### # # Extract from Blender's script library included in scripts/modules. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # ##### END GPL LICENSE BLOCK ##### def read_blend_rend_chunk(file): blendfile = open(file, "rb") head = blendfile.read(7) if head[0:2] == b'\x1f\x8b': # gzip magic blendfile.seek(0) blendfile = gzip.open(blendfile, "rb") head = blendfile.read(7) if head != b'BLENDER': print("not a blend file:", file) blendfile.close() return [] is_64_bit = (blendfile.read(1) == b'-') # true for PPC, false for X86 is_big_endian = (blendfile.read(1) == b'V') # Now read the bhead chunk!!! blendfile.read(3) # skip the version scenes = [] sizeof_bhead = 24 if is_64_bit else 20 while blendfile.read(4) == b'REND': sizeof_bhead_left = sizeof_bhead - 4 struct.unpack('>i' if is_big_endian else '2i' if is_big_endian else '<2i', blendfile.read(8)) scene_name = blendfile.read(64) scene_name = scene_name[:scene_name.index(b'\0')] try: scene_name = str(scene_name, "utf8") except TypeError: pass scenes.append((start_frame, end_frame, scene_name)) blendfile.close() return scenes def get_number_of_frames(file): """Reads the header of the blend file and calculates the number of frames it has. Keyword arguments: file -- Blender file to analyse """ try: frame_start, frame_end, scene = read_blend_rend_chunk(file)[0] except FileNotFoundError as e: print(e.args[1]) sys.exit(2) else: return int(frame_end - frame_start + 1) def download_blender_file_from_s3(uri): """Downloads the blend file from S3 and stores it locally. Keyword arguments: uri -- S3 URI of the file to download """ uri_components = uri.split('s3://')[1].split('/') bucket = uri_components[0] file = uri_components[1] s3 = boto3.resource('s3') s3.meta.client.download_file(bucket, file, '/tmp/{}'.format(file)) return '/tmp/{}'.format(file) def calculate_array_job_size(file, frames_per_job): """Calculates the size of the job array Keyword arguments: file -- Blender file to analyse frames_per_job -- Number of frames each Batch job has to render """ # Get the scene's number of frames by reading the header of the blender file n_frames = get_number_of_frames(file) # Adjust the number of frames per job if needed frames_per_job = min(frames_per_job, n_frames) # Calculate how many jobs need to be submitted return n_frames, math.ceil(n_frames / frames_per_job) def lambda_handler(event, context): # Download the blend file from s3 and save it locally to work with it file = download_blender_file_from_s3(event['inputUri']) # Calculate the size of the array job and extract the number of frames n_frames, array_job_size = calculate_array_job_size(file, int(event['framesPerJob'])) return { 'statusCode': 200, 'body': {'arrayJobSize': array_job_size} } Role: Fn::GetAtt: - PreprocessingServiceRole532E6474 - Arn Handler: index.lambda_handler Runtime: python3.9 Timeout: 300 DependsOn: - bucket43879C71 - PreprocessingServiceRoleDefaultPolicyF8800D5C - PreprocessingServiceRole532E6474 Metadata: aws:cdk:path: RenderingStack/Preprocessing/Resource RenderingPipelineRole4AAB9C07: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: sts:AssumeRole Effect: Allow Principal: Service: Fn::Join: - "" - - states. - Ref: AWS::Region - .amazonaws.com Version: "2012-10-17" Metadata: aws:cdk:path: RenderingStack/RenderingPipeline/Role/Resource RenderingPipelineRoleDefaultPolicy951F3306: Type: AWS::IAM::Policy Properties: PolicyDocument: Statement: - Action: lambda:InvokeFunction Effect: Allow Resource: Fn::GetAtt: - Preprocessing329E01E4 - Arn - Action: batch:SubmitJob Effect: Allow Resource: - Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":batch:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - :job-definition/* - Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":batch:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - :job-queue/* - Action: - events:PutTargets - events:PutRule - events:DescribeRule Effect: Allow Resource: Fn::Join: - "" - - "arn:" - Ref: AWS::Partition - ":events:" - Ref: AWS::Region - ":" - Ref: AWS::AccountId - :rule/StepFunctionsGetEventsForBatchJobsRule Version: "2012-10-17" PolicyName: RenderingPipelineRoleDefaultPolicy951F3306 Roles: - Ref: RenderingPipelineRole4AAB9C07 Metadata: aws:cdk:path: RenderingStack/RenderingPipeline/Role/DefaultPolicy/Resource RenderingPipeline477A29E4: Type: AWS::StepFunctions::StateMachine Properties: RoleArn: Fn::GetAtt: - RenderingPipelineRole4AAB9C07 - Arn DefinitionString: Fn::Join: - "" - - '{"Comment": "Workflow orchestration for a rendering pipeline using AWS Batch","StartAt":"Number of frames extraction","States":{"Number of frames extraction":{"Next":"Rendering","Retry":[{"ErrorEquals":["Lambda.ServiceException","Lambda.AWSLambdaException","Lambda.SdkClientException"],"IntervalSeconds":2,"MaxAttempts":6,"BackoffRate":2}],"Type":"Task","Resource":"arn:' - Ref: AWS::Partition - :states:::lambda:invoke","Parameters":{"FunctionName":" - Fn::GetAtt: - Preprocessing329E01E4 - Arn - '","Payload.$":"$"}, "ResultPath":"$.output"},"Rendering":{"Type":"Task","Resource":"arn:aws:states:::batch:submitJob.sync","Parameters":{"JobName.$":"$.jobName","ArrayProperties":{"Size.$":"$.output.Payload.body.arrayJobSize"},"Parameters":{"action":"render","inputUri.$":"$.inputUri","outputUri.$":"$.outputUri","framesPerJob.$":"$.framesPerJob"},"JobDefinition.$":"$.jobDefinitionArn","JobQueue.$":"$.jobQueueArn"},"Next":"Stitching","ResultPath":"$.output"},"Stitching":{"Type":"Task","Resource":"arn:aws:states:::batch:submitJob.sync","Parameters":{"JobName":"Stitching","Parameters":{"action":"stitch","inputUri.$":"$.outputUri","outputUri.$":"$.outputUri","framesPerJob.$":"$.framesPerJob"},"JobDefinition.$":"$.jobDefinitionArn","JobQueue.$":"$.jobQueueArn"},"End":true}}}' DependsOn: - RenderingPipelineRoleDefaultPolicy951F3306 - RenderingPipelineRole4AAB9C07 Metadata: aws:cdk:path: RenderingStack/RenderingPipeline/Resource CDKMetadata: Type: AWS::CDK::Metadata Properties: Analytics: v2:deflate64:H4sIAAAAAAAA/11RwW7CMAz9Fu4h2+DEkXUMMW1aVRBXlKZGzdrGVeKAqqr/vqRhK9sp9rPj9/y84Ev+OBNXO5dFNa9Vzvs9CVkxD516WaMrVjw5642+KIO6AU2bZMGUaHifYQ3M18Y3xVrJLqRTtNOWhJaQGjyrGgZmrf/mCy8oXRgVmtbWolSCFOqB1aLJC8H7V6dlQELDTzwwkAveH1sZ0GOasNTlnmrvcg3jqCnK0BEcRB4FRnzC7ih/m6NeAuM7t4LgKrobzS1bk/elHFXvQTqjqNsadO1I8Ad4F15xeYCmrUUc/BcJixhvH7RoFaEZiabM27Tk/bOTVdwlRh4laM83L+yJhK2sbxMkS79fo+gNc08d/NvpC1bw78d4WIIPv4TS0Za7fBhYBhadkb7kLGEzpUHcFH86at0oLEFdqHiZtKMS9cOSr/jT7MsqNTdOk2qAZ/H9BoXDYZRoAgAA Metadata: aws:cdk:path: RenderingStack/CDKMetadata/Default Condition: CDKMetadataAvailable Outputs: FISCustomRole: Value: Fn::GetAtt: [FISCustomRole, Arn] Subnet1: Value: Ref: VpcRenderingWithBatchSubnet1SubnetADE6DAA0 Subnet2: Value: Ref: VpcRenderingWithBatchSubnet2SubnetDC61207B LaunchTemplateName: Value: RenderingWithBatch RepositoryName: Value: Ref: repository9F1A3F0B ECSInstanceProfile: Value: Fn::GetAtt: - ecsinstanceprofile - Arn BucketName: Value: Ref: bucket43879C71 BlendFileName: Value: blendfile.blend PreprocessingLambda: Value: Ref: Preprocessing329E01E4 StateMachineArn: Value: Ref: RenderingPipeline477A29E4 Conditions: NotEventEngine: !Equals [!Ref EETeamRoleArn, NONE] CDKMetadataAvailable: Fn::Or: - Fn::Or: - Fn::Equals: - Ref: AWS::Region - af-south-1 - Fn::Equals: - Ref: AWS::Region - ap-east-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-1 - Fn::Equals: - Ref: AWS::Region - ap-northeast-2 - Fn::Equals: - Ref: AWS::Region - ap-south-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-1 - Fn::Equals: - Ref: AWS::Region - ap-southeast-2 - Fn::Equals: - Ref: AWS::Region - ca-central-1 - Fn::Equals: - Ref: AWS::Region - cn-north-1 - Fn::Equals: - Ref: AWS::Region - cn-northwest-1 - Fn::Or: - Fn::Equals: - Ref: AWS::Region - eu-central-1 - Fn::Equals: - Ref: AWS::Region - eu-north-1 - Fn::Equals: - Ref: AWS::Region - eu-south-1 - Fn::Equals: - Ref: AWS::Region - eu-west-1 - Fn::Equals: - Ref: AWS::Region - eu-west-2 - Fn::Equals: - Ref: AWS::Region - eu-west-3 - Fn::Equals: - Ref: AWS::Region - me-south-1 - Fn::Equals: - Ref: AWS::Region - sa-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-1 - Fn::Equals: - Ref: AWS::Region - us-east-2 - Fn::Or: - Fn::Equals: - Ref: AWS::Region - us-west-1 - Fn::Equals: - Ref: AWS::Region - us-west-2