amazon-cloudwatch

How do I set an alarm to terminate an EC2 instance using boto?

谁都会走 提交于 2019-12-11 08:23:33
问题 I have been unable to find a simple example which shows me how to use boto to terminate an Amazon EC2 instance using an alarm (without using AutoScaling). I want to terminate the specific instance that has a CPU usage less than 1% for 10 minutes. Here is what I've tried so far: import boto.ec2 import boto.ec2.cloudwatch from boto.ec2.cloudwatch import MetricAlarm conn = boto.ec2.connect_to_region("us-east-1", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY) cw = boto.ec2

Elastic Beanstalk Log Path Not Updating When Docker Container Changes

蓝咒 提交于 2019-12-11 07:49:34
问题 When I launch an ElasticBeanstalk instance with docker I get log streaming to cloudwatch in a group named /aws/elasticbeanstalk/{app_name}/var/log/eb-docker/containers/eb-current-app/stdouterr.log . If I push an update to this beanstalk app the docker container is terminated, and a new docker container is launched in it's place. The issue is that when this happens, logs are being generated under the new docker container id, but they are not streaming to cloudwatch. How can I update my docker

awslogs-agent-setup.py not working on Ubuntu 17.10 (artful)

旧城冷巷雨未停 提交于 2019-12-11 07:36:54
问题 This works fine on ubuntu 16.04, but not on 17.10 + curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0^M100 56093 100 56093 0 0 56093 0 0:00:01 --:--:-- 0:00:01 98929 + chmod +x ./awslogs-agent-setup.py + ./awslogs-agent-setup.py -n -c /etc/awslogs/awslogs.conf -r us-west-2 Step 1 of 5: Installing pip ...^[

CloudWatch custom metrics not working as expected

橙三吉。 提交于 2019-12-11 05:57:12
问题 I had already created 7 other metrics based on some log files I send to CloudWatch with no problems. Some time ago we had a problem with MongoDB connection, and I identified that through logs, so I'd like to create a Metric, so that I can create an Alarm based on it. I did create the Metric, but (of course) there are no data being fed into that Metic, because no more "MongoError" messages exists. But does that also mean that I can't even access the Metric to create the Alarm? Because this is

CloudWatch Logs agent can't assume role to send logs to different account

陌路散爱 提交于 2019-12-11 04:45:38
问题 I have 2 AWS accounts. Account A: EC2 instances with awslogs client from amazon Account B: Centralized logging account I want to send logs from the EC2 instance with awslogs client ( in account A ) from one account to CloudWatch Logs in an another account ( account B ). It works fine by creating an IAM user in Account B and setting up the AWS credential key in awscli.conf , but I do not want keys to be hardcoded, so I'm trying to assume role as follows: IAM Role in Account B (the CloudWatch

CloudWatch Events trigger on Amazon Transcribe event

时光总嘲笑我的痴心妄想 提交于 2019-12-11 04:35:04
问题 I'm working with the Amazon Transcribe service and trying to get CloudWatch Events to fire a Lambda function that executes a POST request to my API. Here's the Lambda function var querystring = require('querystring'); var http = require('http'); exports.handler = function(event, context) { var post_data = querystring.stringify( event ); // An object of options to indicate where to post to var post_options = { host: '193e561e.ngrok.io', port: '80', path: '/api/lambda', method: 'POST', headers:

How to generate AWS CloudWatch Alarm which involves multiple Metrics

青春壹個敷衍的年華 提交于 2019-12-11 01:57:54
问题 Need to generate CloudWatch Alarm for API Gateway and Lambda functions. For API Gateway CloudWatch Alarm should be generated if 5XX Error count is 10% of total request count at given period (e.g. 5 minutes). Similarly, We need to add a metric if Maximum Latency 6% of total request count > 4 seconds. For such type of metric looks like we need a combination of metric like Sum of total requests and than need to calculate percentage of errors. We have Math Expressions/Metric math which might be

Allow all cloudwatch event rules to have access to lambda function

半城伤御伤魂 提交于 2019-12-11 01:57:07
问题 I have been encountering a hard limit on lambda function policy when trying to provision access for a cloudwatch event rule to trigger the lambda function on a scheduled basis. An error occurred (PolicyLengthExceededException) when calling the AddPermission operation: The final policy size (20670) is bigger than the limit (20480). It works for a new lambda function, but eventually its policy will bloat and will hit a hard limit on the number on cloudwatch event rule that can access it. Some

AWS Cloudwatch not triggering on API calls

安稳与你 提交于 2019-12-11 01:48:33
问题 I am trying to make a rule trigger on any API call for creation, but I haven't had any success. I have another rule that triggers whenever and ec2 instance is running which works, but this rule does not trigger for RunInstances although I see the cloudtrail logs with RunInstances in the API log. I have made a CloudWatch log from the cloudtrail and see the events that should be triggering it, but they don't. Is there a step I am missing? What are the necessary components to have CloudWatch

Set LogStreamName for AWS Lambda call

 ̄綄美尐妖づ 提交于 2019-12-10 22:46:55
问题 We deploy node.js functions onto AWS Lambda. When calling them, they auto-generate an AWS CloudWatch log. The log group is set to the name of the Lambda function, that´s helpful. But the log stream is named like this: 2018/02/14/[$LATEST]794dbaf40a7846c4984ad80ebf110544 . That is not helpful when searching for errors since I need to check multiple log streams, because I do not know which one is the correct one. Is there any way to define the log stream name, so that it is more readable for a