OMERO-cloudformation-templates/OMEROonECS_ALBNLBwithTLS_RW.yaml [1:247]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AWSTemplateFormatVersion: '2010-09-09'

Parameters:
  Namespace:
    Description: A string of 4-20 lowercase letters and digits, starting with a letter. Included in resource names, allowing multiple deployments.
    Default: monai
    Type: String
    AllowedPattern: "^[a-z]{1}[a-z0-9]{3,19}$"
    ConstraintDescription: Between 4-20 letters and digits, starting with a letter
  VPCID:
    Description: ID of the VPC
    Type: AWS::EC2::VPC::Id
  PublicSubnet1Id:
    Description: SubnetId, for Availability Zone 1 in the region in your VPC. The only one OMERO Server instance is deployed in this subnet.
    Type: AWS::EC2::Subnet::Id
  PublicSubnet2Id:
    Description: SubnetId, for Availability Zone 2 in the region in your VPC. None of OMERO Server instance is deployed in this subnet.
    Type: AWS::EC2::Subnet::Id
  PrivateSubnet1Id:
    Description: SubnetId, for Availability Zone 1 in the region in your VPC
    Type: AWS::EC2::Subnet::Id
  PrivateSubnet2Id:
    Description: SubnetId, for Availability Zone 2 in the region in your VPC
    Type: AWS::EC2::Subnet::Id
  LBSecurityGroup:
    Description: Security group for Application Load Balancer
    Type: AWS::EC2::SecurityGroup::Id 
  OmeroSecurityGroup:
    Description: Security group for OMERO web and service containers
    Type: AWS::EC2::SecurityGroup::Id 
  EFSSecurityGroup:
    Description: Security group for EFS
    Type: AWS::EC2::SecurityGroup::Id 
  EFSFileSystem:
    Description: The ID of the EFS volume
    Type: String
  LBAccessLogBucketName:
    Type: String
    Default: lb-accesslog
  RDSEndpointAddress:
    Type: String
    Description: The RDS database endpoinst address
  NumberofWebInstances:
    Type: Number
    Default: 2
  OMEROWebContainerCPU:
    Description: The number of cpu units the Amazon ECS container agent will reserve for the container.
    Type: Number
    Default: 2048
    AllowedValues: [256, 512, 1024, 2048, 4096]
  OMEROWebContainerMemory:
    Description: The amount (in MiB) of memory to present to the container. . Memory should be at least two times of vCPU unit according to documentation.
    Type: Number
    Default: 4096
    AllowedValues: [512, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 30720]
  OMEROServerContainerImage:
    Type: String 
    Default: openmicroscopy/omero-server:latest
  OMEROWebContainerImage:
    Type: String 
    Default: openmicroscopy/omero-web-standalone:latest
  ContainerOnEC2:
    Type: String 
    Default: N 
    Description: will the containers be hosted on ECS EC2 or Fargate launch type
    AllowedValues: [Y, N]
  KeyName:
    Type: String
    Description: Name of an existing EC2 KeyPair to enable SSH access to the EC2 instances. OPTIONAL only for EC2 launch type.
  InstanceType:
    Description: EC2 instance type. OPTIONAL only for EC2 launch type.
    Type: String
    Default: m4.xlarge
    AllowedValues: [t2.large, m3.large,
      m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
      c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
      c3.2xlarge, c3.4xlarge, c3.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge,
      r3.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge]
    ConstraintDescription: Please choose a valid instance type.
  NumberofEC2Instances:
    Description: Number of EC2 instance to run container in ECS cluster. OPTIONAL only for EC2 lanuch type.
    Type: Number
    Default: 3
  OMEROServerContainerCPU:
    Description: The number of cpu units the Amazon ECS container agent will reserve for the container.
    Type: Number
    Default: 4096
    AllowedValues: [256, 512, 1024, 2048, 4096]
  OMEROServerContainerMemory:
    Description: The amount (in MiB) of memory to present to the container. . Memory should be at least two times of vCPU unit according to documentation.
    Type: Number
    Default: 10240
    AllowedValues: [512, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 30720]
  DBUser:
    Type: String
    Default: omero
    Description: OMERO Database User
    NoEcho: true
  RDSDatabaseSecret: 
    Type: String
    Description: OMERO Database Password
    Default: RDSDatabaseSecret
  ExistingHostedZoneId:
    Description: Existing HostedZone for Registered Domain used for ACM Certificate
    Type: AWS::Route53::HostedZone::Id
  FullDomainName:
    Description: Enter the Fully Qualified Domain Nanme for ACM Certificate 
    Type: String

Conditions:
  runContainerOnEC2: !Equals [ !Ref 'ContainerOnEC2', 'Y' ]

Mappings:
  AWSRegionToAMI:
    us-east-1:
      AMIID: ami-01783fbb0757adced
    us-east-2:
      AMIID: ami-0adc4758ea76442e2
    us-west-1:
      AMIID: ami-00becdb34b62bf459
    us-west-2:
      AMIID: ami-09f043c293281ecd4
    ap-northeast-1:
      AMIID: ami-04bbc04d168366d27
    ap-northeast-2:
      AMIID: ami-0273b23020d7a59de
    ap-south-1:
      AMIID: ami-000e4b3f0c9f06ffb
    ap-southeast-1:
      AMIID: ami-071fbc655b2398016
    ap-southeast-2:
      AMIID: ami-032edebfa34883542
    ca-central-1:
      AMIID: ami-092b596d9b942c4f8
    eu-central-1:
      AMIID: ami-097b8c9927f9a27bc
    eu-north-1:
      AMIID: ami-09666749b685f34d5
    eu-west-1:
      AMIID: ami-015b1508a2ff2c65a
    eu-west-2:
      AMIID: ami-0141564f07476504d
    eu-west-3:
      AMIID: ami-04cb3664fdfc392bd
    sa-east-1:
      AMIID: ami-003a04511c336560c

  RegionELBAccountIdMap:
    us-east-1:
      AccountId: '127311923021'
    us-west-1:
      AccountId: '027434742980'
    us-west-2:
      AccountId: '797873946194'
    eu-west-1:
      AccountId: '156460612806'
    ap-northeast-1:
      AccountId: '582318560864'
    ap-northeast-2:
      AccountId: '600734575887'
    ap-southeast-1:
      AccountId: '114774131450'
    ap-southeast-2:
      AccountId: '783225319266'
    ap-south-1:
      AccountId: '718504428378'
    us-east-2:
      AccountId: '033677994240'
    sa-east-1:
      AccountId: '507241528517'
    cn-north-1:
      AccountId: '638102146993'
    eu-central-1:
      AccountId: '054676820928'

Resources:
  CloudMap:
    Type: AWS::ServiceDiscovery::PrivateDnsNamespace
    Properties:
      Description: Service Map for OMERO ECS deployment
      Name: !Sub ${AWS::StackName}.ecscloudmap.org
      Vpc: !Ref VPCID
  OmerowebServiceDiscoveryEntry:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: '"omeroweb" service discovery entry in Cloud Map'
      DnsConfig:
        DnsRecords:
          - TTL: 60
            Type: A
        RoutingPolicy: MULTIVALUE
      HealthCheckCustomConfig:
        FailureThreshold: 1
      Name: omeroweb
      NamespaceId: !Ref 'CloudMap'
  OmeroserverServiceDiscoveryEntry:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: '"omeroserver" service discovery entry in Cloud Map'
      DnsConfig:
        DnsRecords:
          - TTL: 60
            Type: A
        RoutingPolicy: MULTIVALUE
      HealthCheckCustomConfig:
        FailureThreshold: 1
      Name: omeroserver
      NamespaceId: !Ref 'CloudMap'
  
  OMEROECSCluster:
    Type: AWS::ECS::Cluster
    Properties:
      ClusterName: !Sub ${AWS::StackName}-OMEROECSCluster
      ClusterSettings:
        - Name: containerInsights
          Value:  enabled
      Tags:
        - Key: project
          Value: omero-on-aws
  OMEROLoadBalancer:
    DependsOn:
      - LBAccessLogBucket
      - LBAccessLogBucketPolicy
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      LoadBalancerAttributes:
        - Key: load_balancing.cross_zone.enabled
          Value: "true"
      Scheme: internet-facing
      Subnets:
        - !Ref 'PublicSubnet1Id'
        - !Ref 'PublicSubnet2Id'
      SecurityGroups:
        - !Ref LBSecurityGroup
      Tags:
        - Key: project
          Value: omero-on-aws
      Type: application
      LoadBalancerAttributes:
        - Key: access_logs.s3.enabled
          Value: true
        - Key: access_logs.s3.bucket
          Value: !Join
            - '-'
            - - !Ref LBAccessLogBucketName
              - !Ref Namespace
              - !Ref AWS::AccountId
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



OMERO-cloudformation-templates/OMEROonECS_ALBwithTLS_RW.yaml [1:247]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AWSTemplateFormatVersion: '2010-09-09'

Parameters:
  Namespace:
    Description: A string of 4-20 lowercase letters and digits, starting with a letter. Included in resource names, allowing multiple deployments.
    Default: monai
    Type: String
    AllowedPattern: "^[a-z]{1}[a-z0-9]{3,19}$"
    ConstraintDescription: Between 4-20 letters and digits, starting with a letter
  VPCID:
    Description: ID of the VPC
    Type: AWS::EC2::VPC::Id
  PublicSubnet1Id:
    Description: SubnetId, for Availability Zone 1 in the region in your VPC. The only one OMERO Server instance is deployed in this subnet.
    Type: AWS::EC2::Subnet::Id
  PublicSubnet2Id:
    Description: SubnetId, for Availability Zone 2 in the region in your VPC. None of OMERO Server instance is deployed in this subnet.
    Type: AWS::EC2::Subnet::Id
  PrivateSubnet1Id:
    Description: SubnetId, for Availability Zone 1 in the region in your VPC
    Type: AWS::EC2::Subnet::Id
  PrivateSubnet2Id:
    Description: SubnetId, for Availability Zone 2 in the region in your VPC
    Type: AWS::EC2::Subnet::Id
  LBSecurityGroup:
    Description: Security group for Application Load Balancer
    Type: AWS::EC2::SecurityGroup::Id 
  OmeroSecurityGroup:
    Description: Security group for OMERO web and service containers
    Type: AWS::EC2::SecurityGroup::Id 
  EFSSecurityGroup:
    Description: Security group for EFS
    Type: AWS::EC2::SecurityGroup::Id 
  EFSFileSystem:
    Description: The ID of the EFS volume
    Type: String
  LBAccessLogBucketName:
    Type: String
    Default: lb-accesslog
  RDSEndpointAddress:
    Type: String
    Description: The RDS database endpoinst address
  NumberofWebInstances:
    Type: Number
    Default: 2
  OMEROWebContainerCPU:
    Description: The number of cpu units the Amazon ECS container agent will reserve for the container.
    Type: Number
    Default: 2048
    AllowedValues: [256, 512, 1024, 2048, 4096]
  OMEROWebContainerMemory:
    Description: The amount (in MiB) of memory to present to the container. . Memory should be at least two times of vCPU unit according to documentation.
    Type: Number
    Default: 4096
    AllowedValues: [512, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 30720]
  OMEROServerContainerImage:
    Type: String 
    Default: openmicroscopy/omero-server:latest
  OMEROWebContainerImage:
    Type: String 
    Default: openmicroscopy/omero-web-standalone:latest
  ContainerOnEC2:
    Type: String 
    Default: N 
    Description: will the containers be hosted on ECS EC2 or Fargate launch type
    AllowedValues: [Y, N]
  KeyName:
    Type: String
    Description: Name of an existing EC2 KeyPair to enable SSH access to the EC2 instances. OPTIONAL only for EC2 launch type.
  InstanceType:
    Description: EC2 instance type. OPTIONAL only for EC2 launch type.
    Type: String
    Default: m4.xlarge
    AllowedValues: [t2.large, m3.large,
      m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge,
      c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, c3.large, c3.xlarge,
      c3.2xlarge, c3.4xlarge, c3.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge,
      r3.8xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge]
    ConstraintDescription: Please choose a valid instance type.
  NumberofEC2Instances:
    Description: Number of EC2 instance to run container in ECS cluster. OPTIONAL only for EC2 lanuch type.
    Type: Number
    Default: 3
  OMEROServerContainerCPU:
    Description: The number of cpu units the Amazon ECS container agent will reserve for the container.
    Type: Number
    Default: 4096
    AllowedValues: [256, 512, 1024, 2048, 4096]
  OMEROServerContainerMemory:
    Description: The amount (in MiB) of memory to present to the container. . Memory should be at least two times of vCPU unit according to documentation.
    Type: Number
    Default: 10240
    AllowedValues: [512, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 9216, 10240, 11264, 12288, 13312, 14336, 15360, 16384, 30720]
  DBUser:
    Type: String
    Default: omero
    Description: OMERO Database User
    NoEcho: true
  RDSDatabaseSecret: 
    Type: String
    Description: OMERO Database Password
    Default: RDSDatabaseSecret
  ExistingHostedZoneId:
    Description: Existing HostedZone for Registered Domain used for ACM Certificate
    Type: AWS::Route53::HostedZone::Id
  FullDomainName:
    Description: Enter the Fully Qualified Domain Nanme for ACM Certificate 
    Type: String

Conditions:
  runContainerOnEC2: !Equals [ !Ref 'ContainerOnEC2', 'Y' ]

Mappings:
  AWSRegionToAMI:
    us-east-1:
      AMIID: ami-01783fbb0757adced
    us-east-2:
      AMIID: ami-0adc4758ea76442e2
    us-west-1:
      AMIID: ami-00becdb34b62bf459
    us-west-2:
      AMIID: ami-09f043c293281ecd4
    ap-northeast-1:
      AMIID: ami-04bbc04d168366d27
    ap-northeast-2:
      AMIID: ami-0273b23020d7a59de
    ap-south-1:
      AMIID: ami-000e4b3f0c9f06ffb
    ap-southeast-1:
      AMIID: ami-071fbc655b2398016
    ap-southeast-2:
      AMIID: ami-032edebfa34883542
    ca-central-1:
      AMIID: ami-092b596d9b942c4f8
    eu-central-1:
      AMIID: ami-097b8c9927f9a27bc
    eu-north-1:
      AMIID: ami-09666749b685f34d5
    eu-west-1:
      AMIID: ami-015b1508a2ff2c65a
    eu-west-2:
      AMIID: ami-0141564f07476504d
    eu-west-3:
      AMIID: ami-04cb3664fdfc392bd
    sa-east-1:
      AMIID: ami-003a04511c336560c

  RegionELBAccountIdMap:
    us-east-1:
      AccountId: '127311923021'
    us-west-1:
      AccountId: '027434742980'
    us-west-2:
      AccountId: '797873946194'
    eu-west-1:
      AccountId: '156460612806'
    ap-northeast-1:
      AccountId: '582318560864'
    ap-northeast-2:
      AccountId: '600734575887'
    ap-southeast-1:
      AccountId: '114774131450'
    ap-southeast-2:
      AccountId: '783225319266'
    ap-south-1:
      AccountId: '718504428378'
    us-east-2:
      AccountId: '033677994240'
    sa-east-1:
      AccountId: '507241528517'
    cn-north-1:
      AccountId: '638102146993'
    eu-central-1:
      AccountId: '054676820928'

Resources:
  CloudMap:
    Type: AWS::ServiceDiscovery::PrivateDnsNamespace
    Properties:
      Description: Service Map for OMERO ECS deployment
      Name: !Sub ${AWS::StackName}.ecscloudmap.org
      Vpc: !Ref VPCID
  OmerowebServiceDiscoveryEntry:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: '"omeroweb" service discovery entry in Cloud Map'
      DnsConfig:
        DnsRecords:
          - TTL: 60
            Type: A
        RoutingPolicy: MULTIVALUE
      HealthCheckCustomConfig:
        FailureThreshold: 1
      Name: omeroweb
      NamespaceId: !Ref 'CloudMap'
  OmeroserverServiceDiscoveryEntry:
    Type: AWS::ServiceDiscovery::Service
    Properties:
      Description: '"omeroserver" service discovery entry in Cloud Map'
      DnsConfig:
        DnsRecords:
          - TTL: 60
            Type: A
        RoutingPolicy: MULTIVALUE
      HealthCheckCustomConfig:
        FailureThreshold: 1
      Name: omeroserver
      NamespaceId: !Ref 'CloudMap'
  
  OMEROECSCluster:
    Type: AWS::ECS::Cluster
    Properties:
      ClusterName: !Sub ${AWS::StackName}-OMEROECSCluster
      ClusterSettings:
        - Name: containerInsights
          Value:  enabled
      Tags:
        - Key: project
          Value: omero-on-aws
  OMEROLoadBalancer:
    DependsOn:
      - LBAccessLogBucket
      - LBAccessLogBucketPolicy
    Type: AWS::ElasticLoadBalancingV2::LoadBalancer
    Properties:
      LoadBalancerAttributes:
        - Key: load_balancing.cross_zone.enabled
          Value: "true"
      Scheme: internet-facing
      Subnets:
        - !Ref 'PublicSubnet1Id'
        - !Ref 'PublicSubnet2Id'
      SecurityGroups:
        - !Ref LBSecurityGroup
      Tags:
        - Key: project
          Value: omero-on-aws
      Type: application
      LoadBalancerAttributes:
        - Key: access_logs.s3.enabled
          Value: true
        - Key: access_logs.s3.bucket
          Value: !Join
            - '-'
            - - !Ref LBAccessLogBucketName
              - !Ref Namespace
              - !Ref AWS::AccountId
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



