1. 程式人生 > >Start and Stop Instances at Scheduled Intervals Using Lambda and CloudWatch

Start and Stop Instances at Scheduled Intervals Using Lambda and CloudWatch

CloudWatch Events allows you to create an event that is triggered at a specified time or interval in response to events that take place in your account. For example, you can create an event using CloudWatch Events for a specific time of day, or you can create an alarm when CPU utilization for an instance reaches a specific threshold. You can also configure a Lambda function to start and stop instances when triggered by these events.

In this example, we use Lambda functions to start and stop EC2 instances, and then we use CloudWatch Events to start instances in the morning and stop the instances at night.

1.    Open the AWS Lambda console, and choose Create function.
2.    Choose Author from scratch.
3.    Enter a Name

for your function, such as "StopEC2Instances."
4.    From the Runtime drop-down menu, choose Python2.7.
5.    Expand the Role drop-down menu, and then choose Create a custom role. This opens a new tab or window in your browser.
6.    In the IAM Role drop-down menu, choose Create a new IAM Role, and enter a Role Name
, such as “lambda_start_stop_ec2."
7.    Expand View Policy Document, choose Edit, and then choose Ok when prompted to read the documentation. Edit the policy as follows:

相關推薦

Start and Stop Instances at Scheduled Intervals Using Lambda and CloudWatch

CloudWatch Events allows you to create an event that is triggered at a specified time or interval in response to events that take place in your

Securing Amazon EKS Using Lambda and Falco

Intrusion and abnormality detection are important tools for stronger run-time security in applications deployed in containers on Amazon EKS cluste

Stop and Start Amazon EC2 Instances with Data Pipeline

You can use AWS Data Pipeline to programmatically start and stop your EC2 instances at scheduled instances. Data Pipeline uses AWS technologies

Unsupervised Learning and Text Mining of Emotion Terms Using R

true nio sha heatmap this trac tel examples sed Unsupervised learning refers to data science approaches that involve learning without a p

Java與mysql數據庫編程中遇見“Before start of result set at com.mysql.jdbc.SQLError.createSQLException” 的解決辦法

statement sql語句 sql數據庫 mark .sql .cn ava 解決 error 轉載:http://www.cnblogs.com/akiradunn/p/5771513.html 這個Bug是因為在取出ResultSet對象,對其進行操作時,沒有

disable NetworkManager and boot on static ip configuration using /etc/network/interfaces

sta ifdown isa ip link emctl lin mas 8.0 down 1.stop and disable NetworkManager sudo systemctl stop NetworkManager sudo systemctl disable

[TypeScript] Type check JavaScript files using JSDoc and Typescript 2.5

tro wrong check this sta clas sudo ons assertion Typescript 2.5 adds JSDoc type assertion support for javascript file via ts-check servic

uwsgi服務啟動(start)停止(stop)重新裝載(reload)

系統/運維 Linux 1. 添加uwsgi相關文件在之前的文章跟講到過centos中搭建nginx+uwsgi+flask運行環境,本節就基於那一次的配置進行說明。在www中創建uwsgi文件夾,用來存放uwsgi相關文件在uwsgi文件夾中創建uwsgi.pid和uwsgi.status文件,uw

Fast and accurate object detection in high resolution 4K and 8K video using GPUs 論文筆記

文章目錄 一、基本資訊 二、研究背景 三、創新點 3.1 概述 3.2 詳解 3.2.1 問題分析 3.2.2 Attention pipeline 3.2.3 Implementation

mysql 主庫和從庫操作start slave, stop slave

在MySQL配置主從關係時,會用到start slave, stop slave命令,本文簡單介紹兩個命令的使用方法和作用。 start slave mysql> start slave 不帶任何引數,表示同時啟動I/O 執行緒和SQL執行緒。 I/O執行緒從主庫讀取bin log,並存儲到rel

「Linux+Django」uwsgi服務啟動(start)停止(stop)重新裝載(reload)

轉自:http://blog.51cto.com/12482328/2087535?cid=702003 1. 新增uwsgi相關檔案 在之前的文章跟講到過centos中搭建nginx+uwsgi+flask執行環境,本節就基於那一次的配置進行說明。 在www中建立uwsgi資料夾,用來存放uwsgi相

How do I resize an image using PIL and maintain its aspect ratio?

我有一個資料夾,裡的圖檔是 96×96, 我希望在這一個資料夾下的檔案被異動時,會自動產生縮圖(64×64)到其他的資料夾下。 PIL 是 Python 下最有名的影像處理套件。 這個套件,似乎在升級改版本,把一些比較少人用的屬性或方法在新版本裡拿掉,新版本也加入了更多新的功能。一般人應該都只會使用基本

The bug about using hooks and MirroredStrategy in tf.estimator.Estimator

When I was using MirroedStrategy in my tf.estimator.Estimator: Python distribution = tf.contrib.distribute.MirroredStrat

Nginx的啟動(start),停止(stop)命令

檢視Nginx的版本號:nginx -V 啟動Nginx:start nginx 快速停止或關閉Nginx:nginx -s stop 正常停止或關閉Nginx:nginx -s quit 配置檔案修改重灌載命令:nginx -s reload 檢視windows工作管理員下Nginx的程序命令

Analyze and visualize your VPC network traffic using Amazon Kinesis and Amazon Athena

Network log analysis is a common practice in many organizations.  By capturing and analyzing network logs, you can learn how devices on your netwo

Using pam and MySQL to authenticate the users of your PureFTPd server

Using pam and MySQL to authenticate the users of your PureFTPd serverHow to install and configure MySQL, pam-mysql, pure-ftpd, etc…At Alchimie we use FTP a

MIT shows how to tackle fake news using AI and ML

After the recent uproar about "fake news", it is again all quiet in India. Well, not until, another lynching or riot happens. Whatsapp is busy spreading th

Computational model links family members using genealogical and law

Specifically, they have published a computational method for linking individuals in ancestry databases to those in law-enforcement databases. These two da

Why You Can’t Stop Looking at Other People’s Screens

In a world in which other people’s screens are virtually impossible to ignore, there were “no detailed investigations of shoulder surfing incidents and the