Welcome to another cost optimization series !!
AWS Compute is EC2 service that does compute & hosting of applications on cloud. These servers are placed in Region, Availability Zones and then provisioned into a VPC, Subnet isolation and enables us to connect via ports through security groups definitions. Organizations/People rent the server on cloud either on-demand, reserve the instances for business utilization.
Well, that being said, vital point that helps us in cost optimization is stopping the servers, when they aren't used or when there aren't any workloads running. This will help in saving money invested and there are 3 ways of doing that for compute services
Start & Stop
Options are provided from AWS EC2 console and other ways are to use API, SDK, AWS CLI commands to start & stop the servers
AWS Lambda & AWS EventBridge
With AWS Lambda, it is both simple & easy to write python scripts for stopping & starting servers, based on tags(Key, Values). Tags basically, helps AWS Lambda functions to identify the servers to be stopped or started, accordingly.
So the second part is on what frequency this lambda function has to be executed so that the servers are identified for start/stop operations. Here comes, AWS EventBridge cron tab scheduler options where each lambda, can be triggered say evening 6PM daily or every Friday or Monday, as needed. This ensures that functions are triggered and servers are taken care of.
Refer at Link
AWS Instance Scheduler
Finally, fully automated, easy to deploy, configure, AWS provided custom solution is AWS Instance scheduler, which uses lot of services other than AWS Lambda, AWS SNS etc to perform the same stop/start activities on EC2. To know further, please visit AWS Documentation at Link
Go with any option that best suits your business needs !!