Shutdown APIGateway after Budget limit

0

Is there any way to automatically shutdown API gateway that triggers Lambda once my AWS account hits a specific budget limit?

1개 답변
1
수락된 답변

In October of 2020, AWS released AWS Budget Actions [1][2][3]. This enables you to create a budget alert that takes an action. Amongst the possible actions is sending a notification to an SNS topic which can have a Lambda function as a subscriber. That Lambda can do whatever the Lambda has permissions for. Note that AWS Budgets get updated up to 4 times per day. So it could take up to 24 hours for the Budget Alert to notice the increase in API GW spend and therefore trigger the action and Lambda.

[1] https://aws.amazon.com/about-aws/whats-new/2020/10/announcing-aws-budgets-actions/

[2] https://docs.aws.amazon.com/cost-management/latest/userguide/budgets-controls.html

[3] https://aws.amazon.com/blogs/aws-cloud-financial-management/get-started-with-aws-budgets-actions/

profile pictureAWS
전문가
답변함 2년 전
  • I created IAM roles for APIGW and Budgets to which I attached policies allowing the invoking of Lambdas and the attachment/detachment of role policies, respectively. I also created a policy that denies the ability to invoke a Lambda ("kill"). To test I created a usage budget with a threshold right above my current message count, with an action to have Budgets attach the "kill" policy to the APIGW invoke role. I ran my app and waited and it worked as intended: Budgets attached the "kill" policy and stopped APIGW from being able to invoke Lambdas.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠