AWSTemplateFormatVersion: 2010-09-09 Metadata: 'AWS::CloudFormation::Interface': ParameterGroups: - Label: default: 'EFS Persistent Storage' Parameters: - OMEROStorageEFSNameTag - EFSBackup - EFSStorageArchiveAfter - KMSCMKId - Label: default: 'RDS Database' Parameters: - RDSDBInstanceSize - RDSDBStorage - RDSDStorageSize - RDSDBUserName - RDSDBBackupRetainInDays - RDSDBMultiAZ - Label: default: 'ECS' Parameters: - ECSContainerOnEC2 - EC2KeyName - EC2InstanceType - NumberofECSEC2Instances - LoadBalancerAccessLogBucketName - CountofWebInstances - OMEROWebContainerCPUSize - OMEROWebContainerMemorySize - OMEROServerContainerCPUSize - OMEROServerContainerMemorySize - OMEROWebContainerImageParam - OMEROServerContainerImageParam - Label: default: 'Infrastructure' Parameters: - OMEROVPCID - DBECSPrivateSubnet1Id - DBECSPrivateSubnet2Id - LBPublicSubnet1Id - LBPublicSubnet2Id - CIDROMEROSecurityGroup Parameters: StackNamespace: Type: String Default: test OMEROVPCID: Description: ID of the VPC Type: AWS::EC2::VPC::Id DBECSPrivateSubnet1Id: Description: SubnetId, for Availability Zone 1 in the region in your VPC Type: AWS::EC2::Subnet::Id DBECSPrivateSubnet2Id: Description: SubnetId, for Availability Zone 2 in the region in your VPC Type: AWS::EC2::Subnet::Id LBPublicSubnet1Id: 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 LBPublicSubnetAZ1Name: Description: Availability Zone Name for Public Subnet 1. Type: String LBPublicSubnet2Id: 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 LBPublicSubnetAZ2Name: Description: Availability Zone Name for Public Subnet 2. Type: String CIDROMEROSecurityGroup: Type: String Default: '0.0.0.0/0' OMEROStorageEFSNameTag: Description: The name of the EFS volume Type: String MinLength: '1' Default: OMEROEFSvolume KMSCMKId: Description: The ID of the AWS KMS customer master key (CMK) to be used to protect the encrypted EFS and RDS storage. OPTIONAL if not specified, the default CMKs for Amazon EFS and RDS are used. Type: String EFSBackup: Type: String Description: whether enable EFS backup or not. EFS backup has extra associated cost. Default: ENABLED AllowedValues: [ENABLED, DISABLED] EFSStorageArchiveAfter: Type: String Description: A value that describes the period of time that a file is not accessed, after which it transitions to the IA storage class. Default: AFTER_90_DAYS AllowedValues: [AFTER_14_DAYS, AFTER_30_DAYS, AFTER_60_DAYS, AFTER_7_DAYS, AFTER_90_DAYS] RDSDBMultiAZ: Type: String Default: False Description: True or False for RDS Multiple Availability Zone RDSDBInstanceSize: Type: String Default: "db.t3.medium" RDSDBStorage: Type: String Default: "gp2" RDSDStorageSize: Type: Number Default: 20 RDSDBUserName: Type: String Default: omero Description: OMERO Database User NoEcho: true RDSDBBackupRetainInDays: Type: Number Default: 30 Description: The number of days for which automated backups are retained. Setting this parameter to a positive number (from 1 to 35) enables backups. Setting this parameter to 0 disables automated backups. LoadBalancerAccessLogBucketName: Type: String Default: ecs-loadbalancer-accesslog CountofWebInstances: Type: Number Default: 2 Description: Number of OMERO Web containers OMEROServerContainerImageParam: Type: String Default: openmicroscopy/omero-server:latest OMEROWebContainerImageParam: Type: String Default: openmicroscopy/omero-web-standalone:latest OMEROWebContainerCPUSize: 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] OMEROWebContainerMemorySize: 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] ECSContainerOnEC2: Type: String Default: N Description: will the ECS containers be hosted on ECS EC2 or Fargate launch type AllowedValues: [Y, N] EC2KeyName: Type: String Description: Name of an existing EC2 KeyPair to enable SSH access to the ECS EC2 instance hosting OMERO Server. OPTIONAL only for EC2 launch type. NumberofECSEC2Instances: Description: Number of EC2 instance to run container in ECS cluster. OPTIONAL only for EC2 lanuch type. Type: Number Default: 1 EC2InstanceType: Description: ECS 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. OMEROServerContainerCPUSize: 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] OMEROServerContainerMemorySize: 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] Conditions: runContainerOnEC2: !Equals [ !Ref 'ECSContainerOnEC2', 'Y' ] Resources: StorageStack: Type: 'AWS::CloudFormation::Stack' Properties: TemplateURL: https://omero-on-aws.s3-us-west-1.amazonaws.com/OMEROstorage.yaml Parameters: EFSNameTag: !Ref OMEROStorageEFSNameTag VPCID: !Ref OMEROVPCID PrivateSubnet1Id: !Ref DBECSPrivateSubnet1Id PrivateSubnet2Id: !Ref DBECSPrivateSubnet2Id CIDRblock4OMEROSecurityGroup: !Ref CIDROMEROSecurityGroup KMSCustomMasterKey: !Ref KMSCMKId EnableEFSBackup: !Ref EFSBackup EFSStorageInfrequentAcessAfter: !Ref EFSStorageArchiveAfter IsDBMultiAZ: !Ref RDSDBMultiAZ RDSDBInstanceClass: !Ref RDSDBInstanceSize RDSDBStorageType: !Ref RDSDBStorage RDSDBAllocatedStorage: !Ref RDSDStorageSize DBUser: !Ref RDSDBUserName RDSDBBackupRetentionDays: !Ref RDSDBBackupRetainInDays ECScontainerStack: Type: 'AWS::CloudFormation::Stack' Properties: TemplateURL: https://omero-on-aws.s3-us-west-1.amazonaws.com/OMEROonECS_RW.yaml Parameters: Namespace: !Ref StackNamespace VPCID: !Ref OMEROVPCID PublicSubnet1Id: !Ref LBPublicSubnet1Id PublicSubnet2Id: !Ref LBPublicSubnet2Id PrivateSubnet1Id: !Ref DBECSPrivateSubnet1Id PrivateSubnet2Id: !Ref DBECSPrivateSubnet2Id KeyName: !Ref EC2KeyName LBAccessLogBucketName: !Ref LoadBalancerAccessLogBucketName NumberofWebInstances: !Ref CountofWebInstances OMEROWebContainerCPU: !Ref OMEROWebContainerCPUSize OMEROWebContainerMemory: !Ref OMEROWebContainerMemorySize ContainerOnEC2: !Ref ECSContainerOnEC2 InstanceType: !Ref EC2InstanceType NumberofEC2Instances: !Ref NumberofECSEC2Instances OMEROServerContainerCPU: !Ref OMEROServerContainerCPUSize OMEROServerContainerMemory: !Ref OMEROServerContainerMemorySize OMEROServerContainerImage: !Ref OMEROServerContainerImageParam OMEROWebContainerImage: !Ref OMEROWebContainerImageParam DBUser: !Ref RDSDBUserName LBSecurityGroup: Fn::GetAtt: - StorageStack - Outputs.LBSecurityGroup EFSSecurityGroup: Fn::GetAtt: - StorageStack - Outputs.EFSSecurityGroup OmeroSecurityGroup: Fn::GetAtt: - StorageStack - Outputs.OmeroSecurityGroup EFSFileSystem: Fn::GetAtt: - StorageStack - Outputs.EFSFileSystemID RDSEndpointAddress: Fn::GetAtt: - StorageStack - Outputs.RDSEndpointAddress RDSDatabaseSecret: Fn::GetAtt: - StorageStack - Outputs.RDSDatabaseSecret MonitoringStack: Type: 'AWS::CloudFormation::Stack' Properties: TemplateURL: https://omero-on-aws.s3-us-west-1.amazonaws.com/OMEROonECS_Monitoring.yaml Parameters: DashboardName: !Join ['-', [!Ref 'AWS::StackName', !Ref StackNamespace ]] ApplicationELBNameSpace: Fn::GetAtt: - ECScontainerStack - Outputs.ApplicationELBNameSpace ApplicationELBAZ1Name: !Ref LBPublicSubnetAZ1Name ApplicationELBAZ2Name: !Ref LBPublicSubnetAZ2Name ApplicationELBTargetGroupNameSpace: Fn::GetAtt: - ECScontainerStack - Outputs.ApplicationELBTargetGroupNameSpace EC2AutoScalingGroupName: Fn::If: - runContainerOnEC2 - Fn::GetAtt: ECScontainerStack.Outputs.EC2AutoScalingGroupName - !Ref StackNamespace RDSDBInstanceIdentifier: Fn::GetAtt: - StorageStack - Outputs.RDSDBInstanceIdentifier ECSClusterName: Fn::GetAtt: - ECScontainerStack - Outputs.ECSClusterName ContainerOnEC2: !Ref ECSContainerOnEC2 Outputs: OMEROLoadBalancerHTTPEnpoint: Description: The HTTP endpoint of the OMEROLoadBalancer Value: Fn::GetAtt: - ECScontainerStack - Outputs.OMEROLoadBalancerHTTPEnpoint