Questions tagged with Amazon EC2 Auto Scaling

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

I started to follow AWS skill builder training for AWS Solution architect professional. But not sure whether there is anyway I can get the scripts and files they are using to try these labs on my own? Any idea?
0
answers
0
votes
22
views
profile picture
asked 3 months ago
Hi guys, I've found that is possible to use math in a target tracking scaling policy for Amazon EC2 Auto Scaling (https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-target-tracking-metric-math.html) I've tried to use same config in application auto-scaling for service-namespace ECS without success This is my config ``` { "CustomizedMetricSpecification": { "Metrics": [ { "Label": "ack_total", "Id": "m1", "MetricStat": { "Metric": { "MetricName": "rabbitmq_queue_messages_ack_total[switch_events]", "Namespace": "Prometheus" }, "Stat": "Average" }, "ReturnData": false }, { "Label": "published_total", "Id": "m2", "MetricStat": { "Metric": { "MetricName": "rabbitmq_queue_messages_published_total[switch_events]", "Namespace": "Prometheus" }, "Stat": "Average" }, "ReturnData": false }, { "Label": "Relation (ack_total + 1) / (published_total + 1)", "Id": "e1", "Expression": "(m1 + 1)/(m2 + 1)", "ReturnData": true } ] }, "TargetValue": 1.0 } ``` This is the command I've used: ``` aws application-autoscaling put-scaling-policy --service-namespace ecs --policy-name rabbitmq-pub-ack-scaling-policy --scalable-dimension ecs:service:DesiredCount --resource-id "service/XXXXX/events" --policy-type TargetTrackingScaling --target-tracking-scaling-policy-configuration file://alarm-definition.json ``` I'm getting this error: ``` Parameter validation failed: Missing required parameter in TargetTrackingScalingPolicyConfiguration.CustomizedMetricSpecification: "MetricName" Missing required parameter in TargetTrackingScalingPolicyConfiguration.CustomizedMetricSpecification: "Namespace" Missing required parameter in TargetTrackingScalingPolicyConfiguration.CustomizedMetricSpecification: "Statistic" Unknown parameter in TargetTrackingScalingPolicyConfiguration.CustomizedMetricSpecification: "Metrics", must be one of: MetricName, Namespace, Dimensions, Statistic, Unit ``` based on doc available in https://docs.aws.amazon.com/autoscaling/application/APIReference/API_CustomizedMetricSpecification.html seems impossible to use a custom metric with math Best regards.
3
answers
0
votes
173
views
asked 3 months ago
Prevent AWS inspector scanning AWS ec2 instance from autoscaling groups. The AMI we use we scan separately and we don't need to scan each instance on its own. Is there a way to prevent scans of some ec2 instances from inspector.
3
answers
0
votes
51
views
asked 3 months ago
I uploaded my app image to a private repo on ECR, when I start my EC2 instances (autoscale group for ECS service) they hang and eventually fail with "Task failed to start". I have connected to the instances using ssh, and from what I can tell docker never tries to download the image from ECR. I have confirmed that the task definition has the ECR image url defined in the container definitions -> image field, and that the image listed there exists using docker manifest inspect. Anyone have any idea why this could be happening?
1
answers
0
votes
102
views
json
asked 3 months ago
I am trying to replace Launch Configuration by Launch Template for Elastic Beanstalk environment in cloudFormation stack. The namespaces in https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html do not list Launch Template. I want to create Elastic Beanstalk environment with Launch Template for auto scaling group, and EC2 instance using cloudFormation stack. May I know how do I achieve this?
1
answers
0
votes
65
views
Shalini
asked 3 months ago
my standard server is down even though I don't have a different account in any way. I'm getting an error switching to nitro how can I fix this? i want to use my server this is a big mistake
1
answers
0
votes
33
views
asked 3 months ago
Hello, I'm creating a launch template and autoscaling group through cloud formation. The auto-scaling group is currently pointed to the DefaultVersion of the launch template, which is version 1. The latest version of the launch template is version 2. I updated the default version of the launch template to version 3, but I don't see it reflected in the auto-scaling group. I know we update the launch template version through instance refresh, but I would like to know if this is expected behavior to still see version 1 in the autoscaling group even though the default version is now version 2. I want to handle the updates through cloud formation. The problem I'm trying to solve is how do I push changes through cloud formation and handle the updates gracefully in the auto-scaling group. For example - I have two autoscaling groups using the same launch template. Then I decide to update one auto-scaling group to have a different ami. There will be two versions of the launch template, version 1 will have the old ami, and version 2 will have the latest ami. I'd like to gracefully roll out the changes to the autoscaling group 2 through cloud formation. Question 1 - How can I change the auto-scaling group through cloud formation and replace instances gracefully? Question 2 - If I change the version number in the cloud formation template, does it terminate instances first and then redeploy the new ec2 or the other way around?
2
answers
0
votes
265
views
asked 4 months ago
Hello, I have a task that I have to do on my work and I would really appreciate if anyone can assist me on this. The assignment that I have to implement, is to create an 'Auto scaling group' using a value that is returned from a 'lambda function'. After an exhausting research, I have found that i have to Create an 'AutoSG', then select 'Predictive policy' and then choosing 'Custom cloudWatch Metric'. From their somehow i have to select the metric that came from lambda function. My problem their is how to construct 'JSON-formatted payload that contains the custom metric definition on Predictive Policy.' Moreover, do I need to add some additional code in my lambda function to send the returned value to 'Auto scaling Group'? Forgot to mention that my lambda function will executing a query on AWS RDS(mySQL) and return that value. Relative resources: https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html https://aws.amazon.com/blogs/containers/autoscaling-amazon-ecs-services-based-on-custom-cloudwatch-and-prometheus-metrics/
3
answers
0
votes
64
views
asked 4 months ago
Proceed as follows: step 1: go to Launch configurations console. step 2: choose a Launch configuration. step 3: copy to launch template > Copy selected > Copy. I got an error message: "The security group ID 'awseb-e-yy32fjb***-stack-AWSEBSecurityGroup-RKGBZ9JQ****' is not valid. The expected format is sg-xxxxxxxx or sg-xxxxxxxxxxxxxxxxx." After investigating, I realized that AWS is taking "Security name" data instead of "Security ID" when copying Launch configuration to launch template. as in my case above, 'awseb-e-yy32fjbzmp-stack-AWSEBSecurityGroup-RKGBZ9JQ****' is the security group name, AWS sends this data as security group ID, so get above error.
3
answers
0
votes
159
views
asked 4 months ago
I have a scary situation that is currently unfolding. Our production server, which has been running for nearly three years, suddenly terminated itself. We have no idea why or more importantly how since the instance had termination protection enabled. As soon as I learned the server was down I checked the details in AWS and saw that somehow termination protection had been changed to disabled. How is any of this possible? Why would an instance terminate itself? Isn't the point of termination protection to make sure this doesn't happen? I've now got a production environment completely offline and I have no idea why. I'm fortunate that my senior developers were able to jump right in, but they are not AWS experts. So who knows how long it will take to get everything back online. I'd just really like to know how this could happen. Especially with the amount of money I pay each month. I'm just dumbfounded.
1
answers
0
votes
55
views
asked 4 months ago
I received information that Amazon EC2 Launch Configurations will Deprecate support for new Instances (https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/). When running inventory check I see that all Elastic Beanstalk clusters are using deprecated functionality but there is no migration path in documentation. How does the change impacts Elastic beanstalk users?
1
answers
4
votes
129
views
asked 4 months ago
When I check Ram on ec2 instance directly then I got this output. ( see bellow) Mem: 373G 85G 219G 2.8M 68G 285G Swap: 0B 0B 0B Why I have on ec2 just 373 RAM when based on instance type should have 384 RAM ? "i3en.12xlarge RAM = 384"
1
answers
0
votes
59
views
lgriger
asked 4 months ago