AWS Cost Budget 설정

GREEN FIELD·2023년 1월 10일
0
post-thumbnail

AWS Cost Budget 설정건에 관하여,,,

AWS에서는 Budgets이란 서비스로 예산 설정을 지원하는데, 아래 보이는 바와 같이 꽤 세부적인 예산 설정이 가능하다. (단순히 요금 뿐만 아니라 RI, SP 그리고 Usage 사용에 대해서도 지원하는 듯(안 써봄))

일단 오늘 적어볼 내용은 Cost Budget에 관한 것이다.

Cost Budget


보이는 바와 같이 아래를 잘 선택해서 예산을 잡으면 된다.

  • 기간 설정 (Daily, Monthly, Quarterly, Annually)
  • 반복 여부
  • Budgeting Method (고정 금액, 월별로 다르게, auto-adjusting(사용 패턴을 분석해서 알아서 설정해주는 듯? 새로 추가된 기능인 것 같다.))
  • 필터 적용
  • 비용 유형 (Unblended, Amortized, Blended)
  • Charge Type

말하고 싶은 점 1.

비용의 유형은 관점에 따라 다르겠지만 보통 Unblended or Amortized Cost를 많이 볼 것이라 예상된다. 우리는 실제 매월 납부 금액인 Unblended Cost로 예산을 잡았다.

https://stackoverflow.com/questions/70922665/what-is-the-meaning-of-the-different-cost-datasets-in-aws-cost-explorer

말하고 싶은 점 2.

Charge Type을 잘 선택해줘야 한다. Default는 아래와 같다.

기본적으로 Usage 비용 + a로 어떤 charge type을 반영할 지 정할 수 있다.
가령 지난 달 비용을 참고하여 이번 달 예산을 정하는데, 할인이 적용된 지난 달 비용을 기준으로 예산을 잡고 정작 필터에선 discount를 제외하면 예산이 실 사용보다 낮게 책정된 꼴이 된다.

말하고 싶은 점 2.5.

AWS가 참 친절하지 않다고 느끼는게, Console과 API/JSON에서의 Charge Type이 다른 것도 그렇고 캡처에서의 charge type 항목이 어느 범위까지 포함하는지 설명이 좀 약하다. 뭐 대충 보면 뭐겠구나 알겠다만은
Discounts 할인은 모든 Discount를 다 포함하는 것인지,
Other subscription costs는 Other로 묶이는 예외적인 비용들을 포함하는 것인지
궁금하다.

Refunds
Any refunds that you received.

Credits
Any AWS credits that are applied to your account.

Upfront reservation fees
Any upfront fees that are charged to your account. When you purchase an All Upfront or Partial Upfront Reserved Instance from AWS, you pay an upfront fee in exchange for a lower rate for using the instance.

Recurring reservation charges
Any recurring charges to your account. When you purchase a Partial Upfront or No Upfront Reserved Instance from AWS, you pay a recurring charge in exchange for a lower rate for using the instance.

Taxes
Any taxes that are associated with the charges or fees in your budget.

Support charges
Any charges that AWS charges you for a support plan. When you purchase a support plan from AWS, you pay a monthly charge in exchange for service support.

Other subscription costs
Other applicable subscription costs that aren't covered by the other data categories. These costs can include data such as AWS training fees, AWS competency fees, out-of-cycle charges such as registering a domain with Route 53.

Use blended costs
The cost of the instance hours that you used. A blended rate doesn't include either the RI upfront costs or the RI discounted hourly rate.

Use amortized costs
The amortized cost of any reservation hours that you used. For more information about amortized costs, see Show amortized costs.

Discounts
Any enterprise discount such as RI volume discounts. Discount line items don't contain tags.

https://docs.aws.amazon.com/cost-management/latest/userguide/create-cost-budget.html

이 부분은 terraform에서도 cost_types라는 옵션으로 지원하는데

이름을 보면 쉽게 매칭이 된다 (subscription 비용은 경험해보지 못했는데 뭘까)

include_credit             = credit
include_discount           = discount
include_other_subscription = Other subscription costs
include_recurring          = recurring reservation charges
include_refund             = refund
include_subscription       = ???
include_support            = support
include_tax                = taxes
include_upfront            = upfront reservation fees
use_blended                = blended 요금으로 볼 지

https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_budgets_CostTypes.html
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget

말하고 싶은 점 3.

AWS Budget과 다른 AWS Service를 연동하면 예산 초과시 여러가지 액션을 할 수 있다.
AWS Budget에 threshold를 여러개 걸 수 있는데, 각각의 임계값을 넘을 때마다 액션을 다르게 줄 수 있다.

예를 들어
1. 리스트된 이메일에 메일로 알려주기
2. AWS SNS + AWS Chatbot을 연동하여 Slack에 알림 쏘기
3. AWS SNS + AWS Lambda를 연동하여 추가 자원 생성 막기(write deny 시켜버리는 policy를 붙여버림)

사실 회사에서 사용중인 액션들이다.

0개의 댓글