# The AWSTemplateFormatVersion identifies the capabilities of the template # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/format-version-structure.html AWSTemplateFormatVersion: 2010-09-09 Description: >- aws-ecs-opentelemetry Transform: - AWS::Serverless-2016-10-31 Mappings: App: Name: otel: 'otel' Parameters: VpcCIDR: Type: String Default: 10.215.0.0/16 Description: CIDR of the VPC PublicCidrA: Type: String Default: 10.215.10.0/24 Description: CIDR of the Subnet 1 PublicCidrB: Type: String Default: 10.215.20.0/24 Description: CIDR of the Subnet 2 PrivateCidrA: Type: String Default: 10.215.30.0/24 Description: CIDR of the Subnet 1 PrivateCidrB: Type: String Default: 10.215.40.0/24 Description: CIDR of the Subnet 2 PrivateDomain: Type: String Default: demo.local Description: Private domain that will be created for service discovery Resources: VPC: Type: AWS::Serverless::Application Properties: Location: ./templates/vpc.yaml Parameters: Name: !Ref AWS::StackName VpcCIDR: !Ref VpcCIDR PublicCidrA: !Ref PublicCidrA PublicCidrB: !Ref PublicCidrB PrivateCidrA: !Ref PrivateCidrA PrivateCidrB: !Ref PrivateCidrB Cluster: Type: AWS::Serverless::Application Properties: Location: ./templates/ecs-cluster.yaml LoadBalancerA: Type: AWS::Serverless::Application Properties: Location: ./templates/load-balancer.yaml Parameters: Subnets: !GetAtt VPC.Outputs.PublicSubnets VpcId: !GetAtt VPC.Outputs.VpcId LoadBalancerB: Type: AWS::Serverless::Application Properties: Location: ./templates/load-balancer.yaml Parameters: Subnets: !GetAtt VPC.Outputs.PublicSubnets VpcId: !GetAtt VPC.Outputs.VpcId Route53: Type: AWS::Serverless::Application Properties: Location: ./templates/route53.yaml Parameters: VpcId: !GetAtt VPC.Outputs.VpcId PrivateDomain: !Ref PrivateDomain Prometheus: Type: AWS::Serverless::Application Properties: Location: ./templates/prometheus.yaml OtelService: Type: AWS::Serverless::Application Properties: Location: ./templates/otel-service.yaml Parameters: AppName: !FindInMap [ App, Name, otel] VpcCIDR: !Ref VpcCIDR VpcId: !GetAtt VPC.Outputs.VpcId Cluster: !GetAtt Cluster.Outputs.ClusterName Subnets: !GetAtt VPC.Outputs.PrivateSubnets PrivateNamespaceId: !GetAtt Route53.Outputs.PrivateNamespaceId PrometheusEndpoint: !GetAtt Prometheus.Outputs.PrometheusEndpoint SpringBootServiceA: Type: AWS::Serverless::Application Properties: Location: ./templates/service.yaml Parameters: AppName: service-a AppPort: 8080 VpcId: !GetAtt VPC.Outputs.VpcId Cluster: !GetAtt Cluster.Outputs.ClusterName TargetGroup: !GetAtt LoadBalancerA.Outputs.TargetGroup SourceSecurityGroup: !GetAtt LoadBalancerA.Outputs.SecurityGroup Subnets: !GetAtt VPC.Outputs.PrivateSubnets OtelDomain: !Join - "." - - !FindInMap [ App, Name, otel] - !Ref PrivateDomain SpringBootServiceB: Type: AWS::Serverless::Application Properties: Location: ./templates/service.yaml Parameters: AppName: service-b AppPort: 8080 VpcId: !GetAtt VPC.Outputs.VpcId Cluster: !GetAtt Cluster.Outputs.ClusterName TargetGroup: !GetAtt LoadBalancerB.Outputs.TargetGroup SourceSecurityGroup: !GetAtt LoadBalancerB.Outputs.SecurityGroup Subnets: !GetAtt VPC.Outputs.PrivateSubnets OtelDomain: !Join - "." - - !FindInMap [ App, Name, otel] - !Ref PrivateDomain