getting high bills based on their usage.
You can cut down your bills by scheduling EventBridge rules for the instances you are not using.
Go to Amazon EventBridge > Create RuleCreate a new rule and select Rule type as Schedule.
Select Schedule Pattern as - A fine-grained schedule that runs at a specific time
Define the cron expression for instance shutdown schedule.
For eg. cron(30 17 * * ? *) this will stop your EC2 instance at 17:30 everyday
select time zone either as UTC or Local Time Zone
For Target1, select:
- Target Type as "AWS service"
 - Target as "EC2 StopInstances API call", and
 - provide Instance ID to shut down as per schedule.
 - Finally, select Create a new role for this specific resource
 
Review the schedule and instance detail and finish creating the rule.
Known errors -
while adding an eventBridge rule you might get execution role error as show below -
update the attached role to assume scheduler as trusted principal.
{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": {"Service": ["ec2.amazonaws.com","scheduler.amazonaws.com"]},"Action": "sts:AssumeRole"}]}

No comments:
Post a Comment