Skip to main content

AWS Control Tower - Reducing Cost 2

ยท 7 min read
Carlos Angulo Mascarell
info

In this post I'm going to talk about the costs I faced using AWS Control Tower the latest 3 months. I recommend you read my previous post before continuing. Basic knowledge about AWS Control Tower is required.

Latest 3 months costs:

Before I proceed, I have to mention my usage of AFT:

  • I only used it during January and February. I created 5 AWS Accounts.
  • On March I didn't create or enroll any account.

And here we have the costs:

latest 3 months costs

ServiceConfig($)VPC($)Tax($)EC2-Other($)CodeBuild($)KMS($)Lambda($)S3($)DynamoDB($)Backup($)EC2-Instances($)CloudWatch($)Total cost ($)
January16.5817.3410.628.416.621.560.090.010.010.010.010.0161.2
February13.912.510.989.048.51.876.440.010.010.010.010.0163.22
March9.0304.727.440600.010.010.010027.19
info

Let's ignore the Tax from the plot and table.

Detailed cost: Services, API Operations and Usages Type

Let me write down the services used:

  • AWS Config:
    • API Operation: None
    • Usage Type: EU-ConfigurationItemRecorded
  • VPC:
    • API Operation: VpcEndpoint
    • Usage Type: EU-VpcEndpoint-Hours
  • EC2-Other:
    • API Operations: NatGateway, AssociateAddressVPC, here are the costs:
    • Usage Type: EU-NatGateway-Hours,EU-ElasticIP:IdleAddress, EU-NatGateway-Bytes
API OperationNatGateway($)AssociateAddressVPC($)Total
January7.281.138.41
February7.022.029.04
March07.447.44
Usage TypeEU-NatGateway-Hours($)EU-ElasticIP:IdleAddress($)EU-NatGateway-Bytes($)
January7.21.1230.08
February6.242.0190.78
March7.435
  • CodeBuild:
    • API Operation: Build
    • No cost on March because no account was created neither enrolled
  • Key Management Service:
    • API Operation: Unknown
    • Usage Type: eu-west-1-KMS-Keys,eu-west-2-KMS-Keys
Usage Typeeu-west-1-KMS-Keys($)eu-west-2-KMS-Keys($)Total
January1.060.51.56
February1.240.631.87
March426
  • Lambda:
    • API Operation: Invoke
    • Usage Type: EU-Lambda-GB-Second

Analysis

  • The only services that cost independently of usage are:
    • AWS Config
    • EC2-Other
    • KMS
  • AWS Config is the highest cost. I will talk about this in the next section: aws config section
  • Using the improvement to disable the VPC endpoints and NAT explained in my previous post, in March the cost is 0 for the following operations:
    • EU-VpcEndpoint-Hours - service VPC
    • EU-NatGateway-Hours and EU-NatGateway-Bytes - service EC2-Other
  • However, there is still a cost in the EC2-Other service, it is for the API Operation AssociateAddressVPC , usage type: EU-ElasticIP:IdleAddress.
  • The KMS cost has increase in March. I didn't expect this one because I didn't use AFT during that month.
  • Other services ( S3 ,DynamoDB ,Backup ,EC2-Instances ,CloudWatch ) have no cost or less than 0.10.

Questions

  • What AWS Config does ? Can I reduce it cost ?
  • What does the operation EU-ElasticIP:IdleAddress do? How can I decrease this cost?
  • Why KMS cost increase in March if I didn't use AFT? How can I decrease it?

What AWS Config does? Can I reduce it cost?

AWS Config is a AWS service that allow us to record and evaluate resources configurations. You can check the full description here. This service is been used by the AWS Control Tower as described next:

AWS Control Tower has a feature named Guardrails, those are rules validated against resources created in enrolled accounts. This provides governance to AWS environments. Those Guardrails can be preventive (ensuring your account maintain compliance) or Detective (detect noncompliance resources) based on the behavior. The detective guardrails are implemented using AWS Config rules. This means Control Tower call AWS Config to validate the configuration of the resources when a detective guardrails is active.

okey, too much theory, the most important, next are the two detective guardrails activated by default in a landing zone:

Guardrails detectives

danger

The next approach works for me because I'm using AFT sporadically and for personal projects. I don't recommend it for companies because resource history might be required for compliance.

Action done:

  1. Go to AWS Organizations. Create a OU, I name it outside-act.
  2. Move the AFT account to the new OU.
  3. Check it is not enrolled.

aws-ct-account-outside-ou

  1. Open the AWS Console, login using the AFT Account, go to AWS Config, open Settings, click on Edit. and select stop recording, save it.

aws-config-settings aws-config-settings-edit aws-config-setting-recorder-off

costs-after-disable-aws-config-recorder

After disabling Recorder on April 19 the cost was reduced from 0.30 $ per day to 0.03 $

Service2022-04-162022-04-172022-04-182022-04-192022-04-202022-04-212022-04-22
Config($)0.2960.2960.2360.0080.0080.0080.008

What does the operation EU-ElasticIP:IdleAddress do? How can I decrease this cost?

I discovered there were two Elastic IP addresses not linked to any EC2 instances, this is why it is been charged in Idle state. I release them manually, through the AWS Console, so no more cost is generated. More details about why it was been charge here.

As we want to avoid manual intervention, I made the elastic IP creation depend on the aft_vpc_nat_gateway parameter I introduce for reducing NAT costs in my previous post.

elastic-ip-modification

Commit

KMS Costs

info

I will answer this one in my next post. Too much for this one.

Side Notes:

Wait Carlos, were you using the Free Tier?

Yes, I was, and that might reduce the final costs I had, but I don't expect them to be significantly different nor to change any conclusion of this article.

Next is my remaining Free Tier quota on April 18, as you see some services already exceeded the free layer though I haven't used the AFT resources since later February.

free tier stats

Audit and Log AWS Accounts costs

For using AWS Control Tower there are 3 accounts required:

  • Audit Account.
  • Log Archive Account.
  • AFT Account where all the resources to process account creation request are.

Next are the costs per account

Linked Account Namecangulo_aft ($)Log Archive ($)Audit ($)
January61.21.80.2
February63.31.50.02
March27.22.80.01
info

In this post I'm only referring to the AFT account costs.

References:

Git Repositories

learn-terraform-aft-account-provisioning-customizations
learn-terraform-aft-account-customizations
learn-terraform-aft-global-customizations
learn-terraform-aft-account-request

About me

I'm a Software Engineer with experience as Developer and DevOps. The technologies I have worked with are DotNet, Terraform and AWS. For the last one, I have the Developer Associate certification. I define myself as a challenge-seeker person and team player. I simply give it all to deliver high-quality solutions. On the other hand, I like to analyze and improve processes, promote productivity and document implementations (yes, I'm a developer that likes to document ๐Ÿง‘โ€๐Ÿ’ป).

You can check my experience here.

Personal Blog - cangulo.github.io GitHub - Carlos Angulo Mascarell - cangulo
LinkedIn - Carlos Angulo Mascarell
Twitter - @AnguloMascarell

Did you like it? Share It!


Comments