question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(CfnSecurityGroupIngress): unable to access SecurityGroupIngress properties

See original GitHub issue

❓ General Issue

How do you access the SecurityGroupIngress properties?

The following code generates a “software.amazon.jsii.JsiiObject cannot be cast to software.amazon.awscdk.services.ec2.CfnSecurityGroupIngress” error

on the line of code “CfnSecurityGroupIngress sgi = (CfnSecurityGroupIngress)obj;”

  public void TestingSecurityGroupExtraction(CfnInclude template) throws Exception {

    List<IConstruct> lic = template.getNode().getChildren();
    for (IConstruct IC : lic) {
      if (IC instanceof CfnSecurityGroup) {
        CfnSecurityGroup C = (CfnSecurityGroup) IC;
        if (C.getSecurityGroupIngress() != null) {

          List<CfnSecurityGroupIngress> cfnSecurityGroupIngress = (List<CfnSecurityGroupIngress>) C.getSecurityGroupIngress();

          ListIterator<CfnSecurityGroupIngress> it = cfnSecurityGroupIngress.listIterator();
          while (it.hasNext()) {
            Object obj = it.next();
            LOG.debug("obj: " + obj.toString());
            CfnSecurityGroupIngress sgi = (CfnSecurityGroupIngress) obj;
            LOG.debug("getFromPort" + sgi.getFromPort());
          }
        }
      }
    }
  }

How do you get access to the SecurityGroupIngress properties?

Template

AWSTemplateFormatVersion: 2010-09-09
Description: >-
  CloudFormation template that launches an IriusRisk solution
  with an autoscaling WebServers, RDS and LoadBalancer for a client

Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: DNS
        Parameters:
          - CustomerName
          - FQDN
      - Label:
          default: Network configuration
        Parameters:
          - CreateInfra
          - VPCID
          - PrivateSubnet1ID
          - PrivateSubnet2ID
          - PublicSubnet1ID
          - PublicSubnet2ID
          - RemoteAccessCIDR
      - Label:
          default: Workload nodes configuration
        Parameters:
          - InstanceType
          - KeyName
      - Label:
          default: Database configuration
        Parameters:
          - CreateDB
          - DBUrl
          - DBName
          - DBUser
          - DBPassword
          - DBInstanceClass
          - DBStorageType
          - DBAllocatedStorage
          - DBMultiAZ
    ParameterLabels:
      CustomerName:
        default: Customer name
      FQDN:
        default: FQDN
      CreateInfra:
        default: Create basic network stack
      VPCID:
        default: VPC ID (optional)
      PrivateSubnet1ID:
        default: Private subnet 1 ID (optional)
      PrivateSubnet2ID:
        default: Private subnet 2 ID (optional)
      PublicSubnet1ID:
        default: Public subnet 1 ID (optional)
      PublicSubnet2ID:
        default: Public subnet 2 ID (optional)
      RemoteAccessCIDR:
        default: Allowed bastion external access CIDR
      InstanceType:
        default: Workload nodes instance type
      CreateDB:
        default: Create RDS database
      DBUrl:
        default: Database URL (optional)
      DBName:
        default: Database name
      DBUser:
        default: Database user
      DBPassword:
        default: Database password
      DBInstanceClass:
        default: Database instance type
      DBStorageType:
        default: Database storage type
      DBAllocatedStorage:
        default: Size of database instance
      DBMultiAZ:
        default: Multiple Availability Zone

Parameters:
  CustomerName:
    Description: Client name without spaces.
    Type: String
    MinLength: "3"
    MaxLength: "15"
  FQDN:
    Description: Fully Qualified Domain Name.
    Type: String
    MinLength: "10"
    MaxLength: "50"
  RemoteAccessCIDR:
    Description: The IP address range that can be used access the web server instance using SSH (e.g., 0.0.0.0/0).
    Type: String
    MinLength: "9"
    MaxLength: "18"
    AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})'
    ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
  CreateInfra:
    Description: Whether this template should create a dedicated VPC for IriusRisk. If set true, leave the rest of network configuration in blank.
    Type: String
    AllowedValues: [true, false]
    Default: true
  VPCID:
    Description: ID of your existing VPC for deployment (e.g., vpc-f7e21s5s7845s5zc9) (fill only if you are using your own existing resources).
    Type: String
    MaxLength: "25"
  PrivateSubnet1ID:
    Description: ID of private subnet 1 in Availability Zone 1 for the workload (e.g., subnet-a0246dcd) (fill only if you are using your own existing resources).
    Type: String
    MaxLength: "30"
  PrivateSubnet2ID:
    Description: ID of private subnet 2 in Availability Zone 2 for the workload (e.g., subnet-b1f432cd) (fill only if you are using your own existing resources).
    Type: String
    MaxLength: "30"
  PublicSubnet1ID:
    Description: ID of public subnet 1 in Availability Zone 1 for the ELB load balancer (e.g., subnet-9bc642ac) (fill only if you are using your own existing resources).
    Type: String
    MaxLength: "30"
  PublicSubnet2ID:
    Description: ID of public subnet 2 in Availability Zone 2 for the ELB load balancer (e.g., subnet-e3246d8e) (fill only if you are using your own existing resources).
    Type: String
    MaxLength: "30"

  InstanceType:
    Description: Choose your instance size according to your concurrent users and number of products.
    Type: String
    Default: t3a.medium
    AllowedValues:
      - t3.medium
      - t3.large
      - t3.xlarge
      - t3.2xlarge
      - t3a.medium
      - t3a.large
      - t3a.xlarge
      - t3a.2xlarge
      - m5.large
      - m5.xlarge
      - m5.2xlarge
      - m5.4xlarge
      - m5.8xlarge
      - c5.large
      - c5.xlarge
      - c5.2xlarge
      - c5.4xlarge
      - c5.9xlarge
    ConstraintDescription: must be a valid EC2 instance type.
  KeyName:
    Description: Name of an existing EC2 KeyPair to enable SSH access to all instances.
    Type: "AWS::EC2::KeyPair::KeyName"
    ConstraintDescription: must be the name of an existing EC2 KeyPair.

  CreateDB:
    Description: Should we create a database for you? Choose false if you are going to use an existing database.
    Type: String
    AllowedValues: [true, false]
    Default: true
  DBUrl:
    Description: The database URL (e.g., https://my_database_url/) (fill only if you are using an existing database).
    Type: String
    MaxLength: "200"
  DBName:
    Description: Name to be assigned to the database.
    Default: iriusrisk
    Type: String
    MinLength: "1"
    MaxLength: "64"
    AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*"
    ConstraintDescription: must begin with a letter and contain only alphanumeric characters.
  DBUser:
    Description: The database admin account username.
    Default: irius
    Type: String
    MinLength: "1"
    MaxLength: "16"
    AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*"
    ConstraintDescription: must begin with a letter and contain only alphanumeric characters.
  DBPassword:
    Description: The database admin account password.
    NoEcho: "true"
    Type: String
    MinLength: "8"
    MaxLength: "41"
    AllowedPattern: "[a-zA-Z0-9]*"
    ConstraintDescription: must contain only alphanumeric characters.
  DBInstanceClass:
    Description: Database RDS instance type (db.t3.medium is recommended for 20 concurrent users).
    Type: String
    Default: db.t3.medium
    AllowedValues:
      - db.t3.medium
      - db.t3.large
      - db.t3.xlarge
      - db.t3.2xlarge
      - db.m5.large
      - db.m5.xlarge
      - db.m5.2xlarge
      - db.m5.4xlarge
      - db.r5.large
      - db.r5.xlarge
      - db.r5.2xlarge
      - db.r5.4xlarge
    ConstraintDescription: must be a valid RDS instance type.
  DBStorageType:
    Description: Storage type to be associated with the DB instance.
    Type: String
    Default: gp2
    AllowedValues:
      - gp2
      - standard
    ConstraintDescription: must be a valid RDS storage type.
  DBAllocatedStorage:
    Description: The amount of storage (in gigabytes) to be initially allocated for the database instance.
    Type: Number
    MinValue: 8
    MaxValue: 512
    Default: 16
  DBMultiAZ:
    Description: Multi-AZ deployment enables database high availability at higher costs. Please refer to https://aws.amazon.com/rds/details/multi-az/ for more information.
    Type: String
    AllowedValues: [true, false]
    Default: false

Conditions:
  ShouldCreateInfra: !Equals [!Ref CreateInfra, true]
  ShouldCreateDB: !Equals [!Ref CreateDB, true]

Mappings:
  Constants:
    Certificates:
      iriusrisk: arn:aws:iam::154977180039:server-certificate/wildcard-iriusrisk-com-godaddy-until-09-oct-2021
    Versions:
      postgres: 11.8
      iriusrisk: 3.3.0
  AWSAMIRegionMap:
    eu-west-1:
      AMZNLINUXHVM: ami-0acdc41e6e54bcaea
    us-west-1:
      AMZNLINUXHVM: ami-051b4ee3fc4729db4
    eu-central-1:
      AMZNLINUXHVM: ami-086a6423dfc1037d0

Resources:
  VPC:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::VPC"
    Properties:
      EnableDnsSupport: "true"
      EnableDnsHostnames: "true"
      CidrBlock: 10.0.0.0/16
      Tags:
        - Key: "Name"
          Value: !Sub "${CustomerName}-VPC"
        - Key: type
          Value: prod

  PublicSubnet1:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: 10.0.10.0/24
      VpcId: !Ref VPC
      MapPublicIpOnLaunch: "true"
      AvailabilityZone: !Select
        - 0
        - Fn::GetAZs: !Ref "AWS::Region"
      Tags:
        - Key: "Name"
          Value: !Sub "${CustomerName} public subnet 1"
        - Key: type
          Value: prod

  PublicSubnet2:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: 10.0.11.0/24
      VpcId: !Ref VPC
      MapPublicIpOnLaunch: "true"
      AvailabilityZone: !Select
        - 1
        - Fn::GetAZs: !Ref "AWS::Region"
      Tags:
        - Key: "Name"
          Value: !Sub "${CustomerName} public subnet 2"
        - Key: type
          Value: prod

  PrivateSubnet1:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: 10.0.20.0/24
      VpcId: !Ref VPC
      AvailabilityZone: !Select
        - 0
        - Fn::GetAZs: !Ref "AWS::Region"
      Tags:
        - Key: "Name"
          Value: !Sub "${CustomerName} private subnet 1"
        - Key: type
          Value: prod

  PrivateSubnet2:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::Subnet"
    Properties:
      CidrBlock: 10.0.21.0/24
      VpcId: !Ref VPC
      AvailabilityZone: !Select
        - 1
        - Fn::GetAZs: !Ref "AWS::Region"
      Tags:
        - Key: "Name"
          Value: !Sub "${CustomerName} private subnet 2"
        - Key: type
          Value: prod

  InternetGateway:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::InternetGateway"
    Properties:
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName}-IGW"
        - Key: type
          Value: prod

  VPCGatewayAttachment:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::VPCGatewayAttachment"
    Properties:
      VpcId: !Ref VPC
      InternetGatewayId: !Ref InternetGateway

  PublicRouteTable:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::RouteTable"
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName}-RT"
        - Key: type
          Value: prod

  PublicRoute:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::Route"
    DependsOn: VPCGatewayAttachment
    Properties:
      RouteTableId: !Ref PublicRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId: !Ref InternetGateway

  PublicSubnet1RouteTableAssociation:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet1
      RouteTableId: !Ref PublicRouteTable

  PublicSubnet2RouteTableAssociation:
    Condition: ShouldCreateInfra
    Type: "AWS::EC2::SubnetRouteTableAssociation"
    Properties:
      SubnetId: !Ref PublicSubnet2
      RouteTableId: !Ref PublicRouteTable

  ALBServerSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      VpcId: !If [ShouldCreateInfra, !Ref VPC, !Ref VPCID]
      GroupName: !Sub "${CustomerName} ALB SG"
      GroupDescription: Allow access HTTP & HTTPS traffic to ALB
      SecurityGroupIngress:
        - Description: HTTP access from the world
          IpProtocol: tcp
          FromPort: "80"
          ToPort: "80"
          CidrIp: 0.0.0.0/0
        - Description: HTTPS access from the world
          IpProtocol: tcp
          FromPort: "443"
          ToPort: "443"
          CidrIp: 0.0.0.0/0
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} ALB SG"
        - Key: type
          Value: prod

  WebServerSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      VpcId: !If [ShouldCreateInfra, !Ref VPC, !Ref VPCID]
      GroupName: !Sub "${CustomerName} WebServer SG"
      GroupDescription: Allow access HTTP and SSH traffic to WebServerInstance
      SecurityGroupIngress:
        - Description: HTTP access from ALB
          IpProtocol: tcp
          SourceSecurityGroupId: !Ref ALBServerSecurityGroup
          FromPort: "8080"
          ToPort: "8080"
        - Description: SSH access from bastion host
          IpProtocol: tcp
          FromPort: "22"
          ToPort: "22"
          CidrIp: !Ref RemoteAccessCIDR
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} WebServer SG"
        - Key: type
          Value: prod

  RDSSecurityGroup:
    Type: "AWS::EC2::SecurityGroup"
    Properties:
      VpcId: !If [ShouldCreateInfra, !Ref VPC, !Ref VPCID]
      GroupName: !Sub "${CustomerName} RDS SG"
      GroupDescription: Allow access to RDS database
      SecurityGroupIngress:
        - Description: PSQL access from worker nodes
          IpProtocol: tcp
          SourceSecurityGroupId: !Ref WebServerSecurityGroup
          FromPort: "5432"
          ToPort: "5432"
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} RDS SG"
        - Key: type
          Value: prod

  RDSSubnetGroup:
    Type: "AWS::RDS::DBSubnetGroup"
    Properties:
      DBSubnetGroupDescription: !Sub "Subnets for ${CustomerName} RDS"
      DBSubnetGroupName: !Sub "${CustomerName}-rds-subnets"
      SubnetIds:
        - !If [ShouldCreateInfra, !Ref PrivateSubnet1, !Ref PrivateSubnet1ID]
        - !If [ShouldCreateInfra, !Ref PrivateSubnet2, !Ref PrivateSubnet2ID]
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} RDS SG"
        - Key: type
          Value: prod

  RDSIriusRisk:
    Type: "AWS::RDS::DBInstance"
    Properties:
      DBInstanceIdentifier: !Sub "${DBName}-${CustomerName}-rds"
      DBName: !Ref DBName
      DBInstanceClass: !Ref DBInstanceClass
      Engine: postgres
      EngineVersion: !FindInMap [Constants, Versions, postgres]
      StorageType: !Ref DBStorageType
      AllocatedStorage: !Ref DBAllocatedStorage
      MultiAZ: !Ref DBMultiAZ
      MasterUsername: !Ref DBUser
      MasterUserPassword: !Ref DBPassword
      AutoMinorVersionUpgrade: !Ref DBMultiAZ
      DBSubnetGroupName: !Ref RDSSubnetGroup
      VPCSecurityGroups:
        - !Ref RDSSecurityGroup
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} RDS IriusRisk Database"
        - Key: type
          Value: prod

  ApplicationLoadBalancer:
    Type: "AWS::ElasticLoadBalancingV2::LoadBalancer"
    Properties:
      Name: !Sub "${CustomerName}-ALB"
      SecurityGroups:
        - !Ref ALBServerSecurityGroup
      Subnets:
        - !If [ShouldCreateInfra, !Ref PublicSubnet1, !Ref PublicSubnet1ID]
        - !If [ShouldCreateInfra, !Ref PublicSubnet2, !Ref PublicSubnet2ID]
      LoadBalancerAttributes:
        - Key: idle_timeout.timeout_seconds
          Value: 900
        - Key: deletion_protection.enabled
          Value: true
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName}-ALB"
        - Key: type
          Value: prod

  ALBTargetGroup:
    Type: "AWS::ElasticLoadBalancingV2::TargetGroup"
    Properties:
      VpcId: !If [ShouldCreateInfra, !Ref VPC, !Ref VPCID]
      Name: !Sub "${CustomerName}-TG"
      HealthCheckIntervalSeconds: 20
      HealthCheckTimeoutSeconds: 5
      HealthyThresholdCount: 4
      UnhealthyThresholdCount: 2
      HealthCheckPath: /health
      Protocol: HTTP
      Port: 8080
      TargetGroupAttributes:
        - Key: stickiness.enabled
          Value: true
        - Key: stickiness.type
          Value: lb_cookie
        - Key: stickiness.lb_cookie.duration_seconds
          Value: 600
        - Key: deregistration_delay.timeout_seconds
          Value: 300
        - Key: load_balancing.algorithm.type
          Value: round_robin
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName}-TG"
        - Key: type
          Value: prod

  ALBListenerHTTP:
    Type: "AWS::ElasticLoadBalancingV2::Listener"
    Properties:
      DefaultActions:
        - Type: redirect
          RedirectConfig:
            Port: "443"
            Protocol: HTTPS
            StatusCode: HTTP_302
      LoadBalancerArn: !Ref ApplicationLoadBalancer
      Port: "80"
      Protocol: HTTP

  ALBListenerHTTPS:
    Type: "AWS::ElasticLoadBalancingV2::Listener"
    Properties:
      Certificates:
        - CertificateArn: !FindInMap [Constants, Certificates, iriusrisk]
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref ALBTargetGroup
      LoadBalancerArn: !Ref ApplicationLoadBalancer
      Port: "443"
      Protocol: HTTPS

  LaunchConfig:
    Type: "AWS::AutoScaling::LaunchConfiguration"
    Properties:
      LaunchConfigurationName: !Sub "${CustomerName}-LC"
      InstanceType: !Ref InstanceType
      ImageId: !FindInMap
        - AWSAMIRegionMap
        - !Ref "AWS::Region"
        - AMZNLINUXHVM
      KeyName: !Ref KeyName
      SecurityGroups:
        - !Ref WebServerSecurityGroup
      UserData:
        Fn::Base64: !Sub
          - |
            #!/bin/bash -xe
            # Change the version to upgrade the Launch Configuration, do not touch the rest unless necessary
            VERSION=${FindInMapIriusRiskVersion}
            ###### Do not touch below ######
            # Set a trap to let CloudFormation know if the user data script failed
            trap '/opt/aws/bin/cfn-signal --exit-code 1 --resource AutoScalingGroup --region ${AWS::Region} --stack ${AWS::StackName}' ERR
            # Update instance
            yum update -y
            # Redirect web & RDS endpoints in docker-compose file
            sed -i 's/rds.iriusrisk.com/${RDSIriusRisk.Endpoint.Address}/g' /home/ec2-user/docker/docker-compose.yml
            # Change user, password, URL and edition
            sed -i 's/iriusprod/${DBName}/g' /home/ec2-user/docker/docker-compose.yml
            sed -i 's/dbuser/${DBUser}/g' /home/ec2-user/docker/docker-compose.yml
            sed -i 's/dbpassword/${DBPassword}/g' /home/ec2-user/docker/docker-compose.yml
            sed -i 's/http\\:\/\/ha.iriusrisk.com/https\\:\/\/${FQDN}/g' /home/ec2-user/docker/docker-compose.yml
            sed -i 's/ir_edition/saas/g' /home/ec2-user/docker/docker-compose.yml
            # Change docker image
            sed -i "s/container_name\:tag/iriusrisk-prod\:tomcat8-$VERSION/g" /home/ec2-user/docker/docker-compose.yml
            # Change hostname
            echo '${CustomerName}-web' > /etc/hostname
            hostname ${CustomerName}-web
            bash /tmp/change_motd_ec2.sh ${CustomerName}-web
            # Start and enable docker-compose service
            systemctl start docker-compose.service
            systemctl enable docker-compose.service
            # Check IriusRisk availability
            /home/ec2-user/bin/iriusstatus.sh
            # Let CloudFormation know that user data script run successfully
            /opt/aws/bin/cfn-signal --exit-code 0 --resource AutoScalingGroup --region ${AWS::Region} --stack ${AWS::StackName}
          - {
              FindInMapIriusRiskVersion:
                !FindInMap [Constants, Versions, iriusrisk],
            }

  AutoScalingGroup:
    Type: "AWS::AutoScaling::AutoScalingGroup"
    CreationPolicy:
      ResourceSignal:
        Timeout: PT30M
        Count: "1"
    Properties:
      AutoScalingGroupName: !Sub "${CustomerName}-ASG"
      LaunchConfigurationName: !Ref LaunchConfig
      MinSize: "1"
      MaxSize: "3"
      HealthCheckType: ELB
      HealthCheckGracePeriod: 900
      VPCZoneIdentifier:
        - !If [ShouldCreateInfra, !Ref PublicSubnet1, !Ref PublicSubnet1ID]
        - !If [ShouldCreateInfra, !Ref PublicSubnet2, !Ref PublicSubnet2ID]
      TargetGroupARNs:
        - !Ref ALBTargetGroup
      Tags:
        - Key: Name
          Value: !Sub "${CustomerName} WebServer"
          PropagateAtLaunch: "true"
        - Key: endpoint
          Value: !Ref FQDN
          PropagateAtLaunch: "true"
        - Key: type
          Value: prod
          PropagateAtLaunch: "true"

  ASGScaleUpPolicy:
    Type: "AWS::AutoScaling::ScalingPolicy"
    Properties:
      AdjustmentType: ChangeInCapacity
      AutoScalingGroupName: !Ref AutoScalingGroup
      Cooldown: "400"
      ScalingAdjustment: "2"
  CPUAlarmHigh:
    Type: "AWS::CloudWatch::Alarm"
    Properties:
      AlarmName: !Sub "${CustomerName}-CPUUtilization-above-70"
      AlarmDescription: Scale-up if CPU > 70% for 5 minutes
      MetricName: CPUUtilization
      Namespace: AWS/EC2
      Statistic: Average
      ComparisonOperator: GreaterThanThreshold
      Threshold: "70"
      Period: "300"
      EvaluationPeriods: "1"
      AlarmActions:
        - !Ref ASGScaleUpPolicy
      Dimensions:
        - Name: AutoScalingGroupName
          Value: !Ref AutoScalingGroup
  ASGScaleDownPolicy:
    Type: "AWS::AutoScaling::ScalingPolicy"
    Properties:
      AdjustmentType: ChangeInCapacity
      AutoScalingGroupName: !Ref AutoScalingGroup
      Cooldown: "400"
      ScalingAdjustment: "-1"
  CPUAlarmLow:
    Type: "AWS::CloudWatch::Alarm"
    Properties:
      AlarmName: !Sub "${CustomerName}-CPUUtilization-below-30"
      AlarmDescription: Scale-down if CPU < 30% for 10 minutes
      MetricName: CPUUtilization
      Namespace: AWS/EC2
      Statistic: Average
      ComparisonOperator: LessThanThreshold
      Threshold: "30"
      Period: "300"
      EvaluationPeriods: "2"
      AlarmActions:
        - !Ref ASGScaleDownPolicy
      Dimensions:
        - Name: AutoScalingGroupName
          Value: !Ref AutoScalingGroup

Outputs:
  URL:
    Value: !GetAtt "ApplicationLoadBalancer.DNSName"
    Description: Create a new DNS CNAME entry poining your FQDN to this URL

Environment

  • Java AWS CDK Version:1.79
  • OS:ubuntu 18.04
  • Java (Version): 1.8

Other information

https://stackoverflow.com/questions/65569499/how-to-process-aws-cdk-cfnsecuritygroup-in-java?noredirect=1#comment115929349_65569499

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
peterwoodworthcommented, Feb 16, 2021

Hey @jahtoe,

Sorry for the long wait on this issue and thank you for your patience. It’s been looked at and someone will get to it soon

0reactions
github-actions[bot]commented, Oct 22, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::EC2::SecurityGroupIngress - AWS CloudFormation
You can't specify this property with an IP address range. Creates rules that grant full ICMP, UDP, and TCP access. If you specify...
Read more >
AWS CDK - SecurityGroup creation Typescript - Stack Overflow
IngressProperty, but I can't find a way to use it. – user2081381. Jun 15, 2020 at 15:22.
Read more >
AWS::EC2::SecurityGroup - Amazon CloudFormation
Specifies a security group. To create a security group, use the VpcId property to specify the VPC for which to create the security...
Read more >
Declaring Multiple Ingress/Egress Rules in an AWS::EC2
SecurityGroup : Type: AWS::EC2::SecurityGroup Properties: GroupDescription: "Open HTTP (port 80) and SSH (port 22)" VpcId: !
Read more >
Creating an Elastic Load Balancer - Debug This
Using Python to use the CDK to create an Application Load Balancer. ... ELBStack # define custom properties props = { 'namespace':'elb', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found