amazon-cloudwatch

AWS Lambda. Invoke with delay

时光毁灭记忆、已成空白 提交于 2019-12-23 15:44:54
问题 I need to build "tasks scheduler" with Amazon tools. Main problem that i need execute task once with huge delay (it may be a few hours or few weeks). I try to research how to build it with CloudWatch and Lambda function. As i understand - i need to use separate rule for one timeout execution. But AWS allow me only 100 rules/account. Probably i'm going wrong way and this tools not intended for my task. Also i tried SQS, but it did't allow me to set timeout more than 15 minutes. The simplest

Can I change metric units on CloudWatch?

纵然是瞬间 提交于 2019-12-23 12:57:14
问题 I am sending metric data to CloudWatch, and they were sent to AWS with StandardUnit.Count unit, but I later changed them to StandardUnit.Milliseconds. On my dashboard in AWS I still see the data in Count unit. Is it possible to force AWS to show it in Millisecs, or will it change later? Or should I rename my metrics (I would not like that option) 回答1: You do not have to rename your metric. CloudWatch doesn't really care about your unit all that much. From CloudWatch Concepts doc: Units help

Filter CloudWatch Logs to extract Instance ID

喜夏-厌秋 提交于 2019-12-23 05:29:16
问题 I have an AWS Lambda function that is invoked when an instance gets terminated and this the message is stored in Amazon CloudWatch Logs. I want to extract and filter these log messages to get a particular ID. How can I extract the logs and filter it using Python? 回答1: The easiest method might be to create a rule in Amazon CloudWatch Events that triggers an AWS Lambda function. The function automatically passes information relating to the instance that was terminated. You can write the Lambda

How can I dynamically update my AWS CloudWatch dashboards?

自古美人都是妖i 提交于 2019-12-23 01:37:37
问题 I have several dashboards in CloudWatch that represent a static view of my infrastructure, for instance, how many instances from an autoscaling worker group are currently running, or the CPU/disk status of various key EC2 instances. However, when I add new instances, I am always stuck manually updating the dashboards to include them in the display. I'm curious if there is there any way to programmatically populate these dashboards, say through a CLI/API call using an AWS Lambda function? It

Stream logs to elastic using aws cli

非 Y 不嫁゛ 提交于 2019-12-22 18:31:57
问题 I would like to enable the Stream to Amazon Elasticsearch Service from Cloudwatch to Elasticsearch. I'm familiar with how to do that manually, I'm looking for a way to achieve that by running aws cli commands. assuming Elasticsearch is already configured, is there any way to automate the process ? 回答1: Behind the scene Stream to Amazon Elasticsearch service create new lambda and then it pushes the log to Lambda then ELK. destination arn The Amazon Resource Name (ARN) of the Kinesis stream,

AWS CloudWatch Alarm On Startup Of New EC2 Instance

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-22 10:15:40
问题 I want to apply a CloudWatch alarm to instances as they are being created. The alarm should send a message to an email account when CPU usage drops below 10% for 1 full day. I believe the best way of achieving this is by using a User data script at the time of launching the instance. 回答1: Yes, you could use User Data to create the CloudWatch Alarm and notification . Start by creating an Amazon SNS topic for receiving notifications. Subscribe an email address to receive the notifications. This

AWS Cloudwatch logs with Docker Container - NoCredentialProviders: no valid providers in chain

无人久伴 提交于 2019-12-22 04:34:13
问题 My docker-compose file: version: '2' services: scraper: build: ./Scraper/ logging: driver: "awslogs" options: awslogs-region: "eu-west-1" awslogs-group: "doctors-logs" awslogs-stream: "scrapers-stream" volumes: - ./Scraper/spiders:/spiders I have added my AWS credentials to my mac using the aws configure command and the credentials are stored correctly in ~/.aws/credentials When I run docker-compose up I get the following error: ERROR: for scraper Cannot start service scraper: Failed to

Amazon Cloudwatch alarm not triggered

爱⌒轻易说出口 提交于 2019-12-22 03:24:26
问题 I have a cloudwatch alarm configured : Threshold : "GreaterThan 0" for 1 consecutive period, Period : 1 minute, Statistic : Sum The alarm is configured on top of AWS SQS NumberOfMessagesSent. The queue was empty and no messages were being published to it. I sent a message manually. I could see the spike in metric but state of alarm was still OK. I am a bit confused why this alarm is not changing its state even though all the conditions to trigger this are met. 回答1: I just overcame this

AWS Cloudwatch Heartbeat Alarm

醉酒当歌 提交于 2019-12-22 02:07:26
问题 I have an app that puts a custom Cloudwatch metric to AWS every minute. This is supposed to act as a heartbeat so I know the app is alive. Now I want to put an alarm on this metric to notify me if the heartbeat stops. I have tried to accomplish this using different cloudwatch alarm statistics including "average" and "data samples" and setting an alarm threshold less than 1 over a given period. However, in all cases, if my app dies and stops reporting the heartbeat, the alarm will only go into

No logs appear on Cloudwatch log group for elastic beanstalk environment

一世执手 提交于 2019-12-22 01:14:53
问题 I have an elastic beanstalk environment, which is running a docker container that has a node js API. On the AWS Console, if I select my environment, then go to Configuration/Software I have the following: Log groups: /aws/elasticbeanstalk/my-environment Log streaming: Enabled Retention: 3 days Lifecycle: Keep after termination . However, if I click on that log group on the Cloudwatch console, I have a Last Event Time of some weeks ago (which I believe corresponds to when the environment was