• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Start/Stop the EC2 Instance by using Lambda Function

{{postValue.id}}

To Start/Stop the EC2 Instance by using Lambda Function

Introduction:

AWS Lambda is a serverless compute service that can run the code in response to events and manages the compute resources that can use AWS Lambda to extend other AWS services with custom logic or create the own back-end services that run at AWS scale, performance, and security. Amazon Elastic Compute Cloud (Amazon EC2) is a web service that delivers reliable, resizable compute capacity in the cloud that is designed to make web-scale cloud computing more comfortable for developers.

Login to your AWS account:

In console page select EC2 to create a new instance: Snap1 Create a new a Instance: Snap2 Snap3 Snap4 Snap5 Snap6

Snap7 Snap8 Snap9 Snap10 Snap11 Then create a role for Lambda function with permission: Snap12 Snap13 Snap14 Snap15 Snap16 Snap17 Snap20 Snap21 Then open the new role and create a inline policy: Snap22 Snap23 Snap24 Snap25 Snap26 Add ARN to restrict the Instances: Snap27 Snap28 Snap29 Snap30 Create a Lambda Function: Snap31 Snap33 Snap34 Snap35 This is the Function I had written to stop the instance: Snap36 Snap37 Then Increase the execution time in settings: Snap38 Snap39 Deploy the changes and run the function: Snap40

Snap41 Snap42 It will show the status of the instance is stopped: Snap43 Snap44 Then start the Instance by changing the code in function: Snap45 Snap46 Snap47 With this method to Start/Stop the EC2 instance by using Lambda Function comes to an end.

Tags:
jayce
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is AWS Lambda?

A

AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic or create your own back-end services that operate at AWS scale, performance, and security.

Q

What languages does AWS Lambda support?

A

AWS Lambda natively supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code, and provides a Runtime API that allows you to use any additional programming languages to author your functions. Please read our documentation on using Node.js, Python, Java, Ruby, C#, Go, and PowerShell.

Q

How does a lambda function work?

A

AWS Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code only when needed and scales automatically, from a few requests per day to thousands per second. You pay only for the compute time that you consume—there is no charge when your code is not running.

Q

How does AWS Lambda isolate my code?

A

Each AWS Lambda function runs in its own isolated environment, with its own resources and file system view. AWS Lambda uses the same techniques as Amazon EC2 to provide security and separation at the infrastructure and execution levels.

Q

How long can an AWS Lambda function execute?

A

AWS Lambda functions can be configured to run up to 15 minutes per execution. You can set the timeout to any value between 1 second and 15 minutes.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help David Lopez Guillen ?
Ayuda urgente instale SSL para servidor Opensuse y ahora no funciona tengo servicio web

hola segui este tutorial para tener un certificado ssl y ahora no se ve mi app en la red, espero alguien pueda ayudarme, tengo M9oodle en3.5 en un servidor open suse y ahora no funciona por favor ayuda.

https://www.linuxhelp.com/how-to-create-ssl-certificate-in-opensuse

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.