skip to Main Content

I created the AWS auto scaling group, in that multiple ec2 instances are running, how to set that only specific/particular ec2 instance to access/connect RDS? I am new to the AWS so can anyone please answer to my question?

2

Answers


  1. To allow your EC2 instance to be able to access an AWS service (like RDS) create an IAM role with the desired permissions and assign it to your EC2 instance.

    About EC2 instance profiles
    https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html
    All your auto scaling group members should be identical in terms of compute resources and permissions, AWS will increase or decrease the number of instances in your auto scaling group based on policies and parameters (min, max, desired instances, and scaling policy).

    With Auto Scaling Groups (ASG) you first define a Launch Template which specifies the hardware and os that your EC2 instances in your ASG should run, and specify the min, max, desired number of instances in the group and a set of rules which AWS will use to add/remove instances from your ASG.
    About AWS Auto Scaling
    https://aws.amazon.com/ec2/autoscaling/?sc_channel=ba&sc_campaign=autoscaling-ec2-button&sc_medium=button&sc_country=global&sc_geo=global&sc_outcome=aware

    hope that was useful

    Login or Signup to reply.
  2. Your case is unreasonable. But I will suggest my own way (tip) in this case.
    Suppose you have 3 instances running all the time, and can scale up to 10 instances.

    • Setup scale with min max desire number is 3 3 10 respectively
    • Set scale policy to "Newest instance"
    • Create an additional security group, allowing this SG from the RDS SG.
    • Attach this SG to your first scaled-out instance

    In this case the first scaled instance will never be terminated unless it crashes. And you will again attach the allowed SG to another instance. Newer scaled instances will be deleted first.

    But I think, if only 1 instance is allowed in RDS, leave it out of the autoscaling group, because it doesn’t belong to the group.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search