cvat-aws-all.yaml [482:612]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Policies:
        - PolicyName: SageMakerEnpointInvoke
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Sid: SageMakerEnpointInvokeSid
                Effect: Allow
                Action: "sagemaker:InvokeEndpoint"
                Resource: "*"
      AssumeRolePolicyDocument:
        Version: '2008-10-17'
        Statement:
        - Sid: ''
          Effect: Allow
          Principal:
            Service: ecs-tasks.amazonaws.com
          Action: sts:AssumeRole

  LogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: /ecs/cvat

  CVATEfs:
    Type: AWS::EFS::FileSystem
    Properties:
      FileSystemTags:
        - Key: Name
          Value: CVAT_EFS
      Encrypted: true

  EFSMountTarget1:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet1
      SecurityGroups:
      - !Ref EfsSecurityGroup

  EFSMountTarget2:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet2
      SecurityGroups:
      - !Ref EfsSecurityGroup

  EFSMountTarget3:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet3
      SecurityGroups:
      - !Ref EfsSecurityGroup

  DataAccessPoint:
    Type: 'AWS::EFS::AccessPoint'
    Properties:
      FileSystemId: !Ref CVATEfs
      PosixUser:
        Uid: "1000"
        Gid: "1000"
      RootDirectory:
        CreationInfo:
          OwnerGid: "1000"
          OwnerUid: "1000"
          Permissions: "0755"
        Path: "/data"

  ShareAccessPoint:
    Type: 'AWS::EFS::AccessPoint'
    Properties:
      FileSystemId: !Ref CVATEfs
      PosixUser:
        Uid: "1000"
        Gid: "1000"
      RootDirectory:
        CreationInfo:
          OwnerGid: "1000"
          OwnerUid: "1000"
          Permissions: "0755"
        Path: "/share"

  CmdTaskDefinition: 
    Type: AWS::ECS::TaskDefinition
    Properties:
      ExecutionRoleArn: !GetAtt EcsTaskRole.Arn
      ContainerDefinitions:
        - LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-group: !Ref LogGroup
              awslogs-region: !Ref AWS::Region
              awslogs-stream-prefix: ecs
          EntryPoint:
            - sh
            - "-c"
          PortMappings:
            - HostPort: 8080
              Protocol: tcp
              ContainerPort: 8080
          Command:
            - >
              /opt/venv/bin/python manage.py migrate &&
              /opt/venv/bin/python manage.py createsuperuser --no-input
          Environment:
            - Name: ADAPTIVE_AUTO_ANNOTATION
              Value: 'false'
            - Name: ALLOWED_HOSTS
              Value: "*"
            - Name: CVAT_POSTGRES_HOST
              Value: !GetAtt DBInstance.Endpoint.Address
            - Name: CVAT_POSTGRES_PASSWORD
              Value: !Ref DBPassword
            - Name: CVAT_POSTGRES_USER
              Value: !Ref DBUser
            - Name: CVAT_REDIS_HOST
              Value: !GetAtt ElasticacheCluster.RedisEndpoint.Address
            - Name: DJANGO_MODWSGI_EXTRA_ARGS
              Value: ''
            - Name: DJANGO_SUPERUSER_EMAIL
              Value: admin@example.com
            - Name: DJANGO_SUPERUSER_PASSWORD
              Value: !Ref CVATPassword
            - Name: DJANGO_SUPERUSER_USERNAME
              Value: !Ref CVATUser
          MountPoints:
            - ContainerPath: "/home/django/data"
              SourceVolume: cvat-data
            - ContainerPath: "/home/django/share"
              SourceVolume: cvat-share
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



cvat-aws-ap-northeast-1-all.yaml [482:612]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      Policies:
        - PolicyName: SageMakerEnpointInvoke
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Sid: SageMakerEnpointInvokeSid
                Effect: Allow
                Action: "sagemaker:InvokeEndpoint"
                Resource: "*"
      AssumeRolePolicyDocument:
        Version: '2008-10-17'
        Statement:
        - Sid: ''
          Effect: Allow
          Principal:
            Service: ecs-tasks.amazonaws.com
          Action: sts:AssumeRole

  LogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: /ecs/cvat

  CVATEfs:
    Type: AWS::EFS::FileSystem
    Properties:
      FileSystemTags:
        - Key: Name
          Value: CVAT_EFS
      Encrypted: true

  EFSMountTarget1:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet1
      SecurityGroups:
      - !Ref EfsSecurityGroup

  EFSMountTarget2:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet2
      SecurityGroups:
      - !Ref EfsSecurityGroup

  EFSMountTarget3:
    Type: AWS::EFS::MountTarget
    Properties:
      FileSystemId: !Ref CVATEfs
      SubnetId: !Ref PrivateSubnet3
      SecurityGroups:
      - !Ref EfsSecurityGroup

  DataAccessPoint:
    Type: 'AWS::EFS::AccessPoint'
    Properties:
      FileSystemId: !Ref CVATEfs
      PosixUser:
        Uid: "1000"
        Gid: "1000"
      RootDirectory:
        CreationInfo:
          OwnerGid: "1000"
          OwnerUid: "1000"
          Permissions: "0755"
        Path: "/data"

  ShareAccessPoint:
    Type: 'AWS::EFS::AccessPoint'
    Properties:
      FileSystemId: !Ref CVATEfs
      PosixUser:
        Uid: "1000"
        Gid: "1000"
      RootDirectory:
        CreationInfo:
          OwnerGid: "1000"
          OwnerUid: "1000"
          Permissions: "0755"
        Path: "/share"

  CmdTaskDefinition: 
    Type: AWS::ECS::TaskDefinition
    Properties:
      ExecutionRoleArn: !GetAtt EcsTaskRole.Arn
      ContainerDefinitions:
        - LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-group: !Ref LogGroup
              awslogs-region: !Ref AWS::Region
              awslogs-stream-prefix: ecs
          EntryPoint:
            - sh
            - "-c"
          PortMappings:
            - HostPort: 8080
              Protocol: tcp
              ContainerPort: 8080
          Command:
            - >
              /opt/venv/bin/python manage.py migrate &&
              /opt/venv/bin/python manage.py createsuperuser --no-input
          Environment:
            - Name: ADAPTIVE_AUTO_ANNOTATION
              Value: 'false'
            - Name: ALLOWED_HOSTS
              Value: "*"
            - Name: CVAT_POSTGRES_HOST
              Value: !GetAtt DBInstance.Endpoint.Address
            - Name: CVAT_POSTGRES_PASSWORD
              Value: !Ref DBPassword
            - Name: CVAT_POSTGRES_USER
              Value: !Ref DBUser
            - Name: CVAT_REDIS_HOST
              Value: !GetAtt ElasticacheCluster.RedisEndpoint.Address
            - Name: DJANGO_MODWSGI_EXTRA_ARGS
              Value: ''
            - Name: DJANGO_SUPERUSER_EMAIL
              Value: admin@example.com
            - Name: DJANGO_SUPERUSER_PASSWORD
              Value: !Ref CVATPassword
            - Name: DJANGO_SUPERUSER_USERNAME
              Value: !Ref CVATUser
          MountPoints:
            - ContainerPath: "/home/django/data"
              SourceVolume: cvat-data
            - ContainerPath: "/home/django/share"
              SourceVolume: cvat-share
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



