1. How to read this material
This material accompanies Lesson 12, which has two hours. In the first, the professor prices on AWS the DataApp built in Lesson 7, tcg-dataapp, in four steps: the measurement of its workload, the description of five candidate architectures, their estimate in the AWS Pricing Calculator and in code, and the optimisation of the cheapest one. In the second hour each group repeats the four steps over its own DataApp.
Part I explains how a cloud bill is formed and where its prices come from. Parts II to V follow the four steps of the session, and Part VI gathers the activity of the groups, the prompts, the common mistakes and the references. Every price was read from the public AWS Price List on 08/11/2026 and every measure of the workload was taken on the same day; both change, and the AWS Pricing Calculator remains the reference for a real estimate. The lab of the session holds the same model in a page, where every quantity and every price can be edited.
2. A bill is a sum of quantities times unit prices
AWS does not sell a server for a fixed monthly fee. Each service counts one or more billing dimensions, such as the hours in which an instance runs, the gigabyte-seconds of memory used by a function or the gigabytes kept in a bucket during a month, and the bill multiplies each counted quantity by its unit price. The total of a month is the sum of these products, and estimating it means first estimating the quantities that the workload will produce, because the unit prices are public and fixed for a given region and pricing model.
The consequence for the design of a DataApp is that two architectures that run the same code can differ in cost by orders of magnitude, depending on which dimensions they turn into cost. A dimension counted by time, such as instance hours, is paid whether the DataApp works or not; a dimension counted by use, such as GB-seconds of a function, is paid only while it works. The table lists the dimensions used in this session, with their prices in us-east-1.
| Service | What is counted | Unit | Unit price, us-east-1 | Driven by |
|---|---|---|---|---|
| EC2 t4g.small | time the instance is running | hour | $0.0168 | hours on, not hours of work |
| EBS gp3 | provisioned volume | GB-month | $0.08 | size, even with the instance stopped |
| Public IPv4 | address in use | hour | $0.005 | hours the address is attached |
| Lambda, ARM | compute | GB-second | $0.0000133334 | runs × duration × memory |
| Lambda | requests | request | $0.0000002 | runs |
| Fargate, ARM | vCPU and memory of the task | vCPU-hour, GB-hour | $0.03238 and $0.00356 | runs × billed duration × size |
| S3 Standard | stored data | GB-month | $0.023 | data kept |
| S3 | PUT, COPY, POST, LIST; GET | request | $0.000005; $0.0000004 | files written and read |
| RDS for PostgreSQL db.t4g.micro | time the database is running | hour | $0.016 | 730 hours a month |
| Data transfer out | bytes sent to the internet | GB | $0.09 | readers; data coming in is free |
3. Pricing models: on-demand, commitments and Spot
The unit price of compute depends on how the capacity is bought. On-demand capacity has no commitment and, for Linux instances, is billed per second with a minimum of one minute. A commitment lowers the rate in exchange for a promise to pay it for one or three years, every hour, whether the capacity is used or not: a Reserved Instance or an EC2 Instance Savings Plan is tied to an instance family in a region, while a Compute Savings Plan is a commitment in USD per hour that applies to EC2, Fargate and Lambda in any region, with a smaller discount. Spot capacity is spare capacity sold below on-demand, which AWS can reclaim with two minutes of notice.
| Model | t4g.small, us-east-1, per hour | Condition |
|---|---|---|
| On-demand | $0.0168 | no commitment |
| Compute Savings Plan, 1 year, no upfront | $0.0121 | commitment in USD per hour; EC2, Fargate and Lambda |
| Reserved Instance, standard, 1 year, no upfront | $0.0105 | tied to the instance type and region |
| EC2 Instance Savings Plan, 1 year, no upfront | $0.0105 | tied to the instance family and region |
| Spot | about $0.0072 | average saving of 57% by the Spot Instance Advisor; interruptible |
A commitment is worth its discount only above a utilisation of break-even, which is the ratio between the committed rate and the on-demand rate: for the reserved t4g.small, 0.0105 / 0.0168 = 62.5%. An instance that runs fewer than 62.5% of the hours of the year costs less on-demand. The Price List also carries free allowances, which are the zero-price first tiers of some services: one million Lambda requests and 400,000 GB-seconds per month, 14 million invocations of EventBridge Scheduler and 100 GB of data transfer out per month, aggregated across the account. Because these allowances belong to the account and are shared by all its workloads, an estimate for one DataApp is shown both with and without them.
4. Where the prices come from
AWS publishes its prices in two forms. The AWS Pricing Calculator, at calculator.aws, is a form in which the user chooses a service, a region and a configuration and receives a monthly and an annual total; an estimate can be saved with a share link and exported as CSV, PDF or JSON, and it is the format in which an estimate reaches a manager or a partner. The AWS Price List is the same catalogue as files: one JSON or CSV document per service and region, available at pricing.us-east-1.amazonaws.com without an account or a key, in which each price has an offer code, a usage type, a unit and the date on which the offer was published.
The lab of this session uses a snapshot of the Price List taken by capture/snapshot_prices.py, kept in data/prices.json with 17 KB. Most offers are small, but the EC2 offer of one region has about 480 MB and the Savings Plans offer about 440 MB, so the script reads the EC2 file as CSV in a stream, keeps only six instance types and deletes the Savings Plans files after reading them. Every price of the snapshot keeps its provenance, as in the entry below, and the lab shows it next to the value.
"public_ipv4_hour": {
"usd": 0.005,
"unit": "Hrs",
"offer": "AmazonVPC",
"usagetype": "USE1-PublicIPv4:InUseAddress",
"published": "2026-11-05T18:19:45Z"
}The month of the calculator has 730 hours, and the model of the lab uses the same number. Prices are in USD and do not include taxes.
5. Measuring the workload
The first step measures the quantities of the workload before any price is looked up, since every line of the bill multiplies one of them. Some quantities are measured by running the DataApp, and others are decided by the group or assumed, such as the number of runs per month or the volume read by the users; the document of the workload records the origin of each, so that a reader of the estimate can tell a measure from a hypothesis. The run below was measured on 08/11/2026 with /usr/bin/time -v over tcg-dataapp run of Lesson 7, in a new virtual environment.
| Quantity | Value | Origin |
|---|---|---|
| wall time of a run | 25.6 s | measured; the reference of Lesson 7 is about 40 s, used in the estimates |
| CPU time, user and system | 10.8 s and 1.1 s | measured |
| peak resident memory | 392 MB | measured |
| warehouse/tcg.duckdb | 1.85 MB | measured |
| out/: report.md and three Parquet files | 0.09 MB | measured |
| downloaded per run | 21.6 MB | measured: five archives of 19.8 MB and a catalogue of 1.8 MB |
| runs per month | 30 | decision: one run a day |
| egress to readers | 1 GB per month | assumption |
| downloads by readers | 300 GET requests per month | assumption |
6. What the measures imply
Three readings of the table guide the rest of the session. Thirty runs of forty seconds add up to twenty minutes in a month of 730 hours, so the DataApp works during 0.05% of the month; any resource billed by time is paid almost entirely for idle hours. The CPU time of a run is less than a third of its wall time, because most of the run waits for the downloads of tcgcsv, so a larger machine would shorten the run very little. And the peak memory of 392 MB, not the average, sets the smallest size that can run the DataApp: with a margin of 30% it needs about 510 MB, which fits an instance or a function of 1 GB.
The 21.6 MB downloaded per run cost nothing, because AWS does not charge data transfer into its regions. They still matter, because they explain the duration of the run, and a DataApp that downloaded a hundred times more data would take longer and pay more in every architecture billed by duration.
7. Five architectures for the same package
The second step describes architectures that run the same package and differ in what they keep billed. Architecture A keeps an EC2 instance on, with its volume and public address, and runs the package by cron, as the README of Lesson 7 suggests. B uses the same instance but starts it for each run and stops it afterwards. C runs the package as a Lambda function, started by EventBridge Scheduler, which reads the DuckDB file from S3 at the start of the run and writes it back with the marts at the end. D runs the package in a container as an ECS Fargate task, started by the same scheduler, with the image kept in ECR. E adds to D a database of RDS for PostgreSQL, which serves the gold layer to readers that need SQL.
| Architecture | Billed while working | Billed while idle |
|---|---|---|
| A · EC2 always on | instance hours | the instance, the volume and the public IPv4, 730 hours |
| B · EC2 started for each run | instance and IPv4 during the run and the boot | the EBS volume |
| C · Lambda + Scheduler + S3 | GB-seconds, one request per run, S3 requests | the bytes kept in S3 |
| D · Fargate task + Scheduler + S3 | vCPU and memory from the image pull to the end of the task | the image in ECR and the bytes in S3 |
| E · D + RDS for PostgreSQL | as D | the database instance and its storage, 730 hours |
flowchart LR
sch[EventBridge Scheduler<br/>cron 0 6 * * ? *] --> fn[Lambda tcg-dataapp<br/>ARM, 1 GB]
fn -->|download and upload tcg.duckdb| s3[(S3 Standard)]
fn -->|archives and catalogue| src[tcgcsv.com]
readers[readers] -->|GET report and marts| s38. Limits that decide the choice
Price is not the only criterion, because each service imposes limits on the workload. A Lambda function stops any invocation at 15 minutes and has between 128 MB and 10,240 MB of memory, with an ephemeral disk in /tmp of 512 MB by default; the forty seconds and 392 MB of tcg-dataapp fit with a large margin, but a DataApp whose run approaches fifteen minutes needs another service. A Fargate task has no limit of duration and includes 20 GB of ephemeral storage in its price, but bills from the start of the image pull to the end of the task, with a minimum of one minute, so a short run pays for the start of its container. An EC2 instance has no limit either, and its boot adds to the billed time of architecture B.
Some resources are billed while idle without being visible in the diagram. An EBS volume is billed while its instance is stopped; a public IPv4 address is billed by the hour while it is attached; a database instance is billed every hour; and a NAT gateway or a load balancer, which these architectures avoid, are billed every hour as well. The estimate must include them, because in a DataApp that works 0.05% of the month they can be most of the bill.
9. The estimate in the AWS Pricing Calculator
The calculator is filled by hand, one service at a time, and the procedure below produces an estimate that can be compared with the code and shared with the partner.
- Open
calculator.awsand choose Create estimate. - Add a group per architecture, for example B · EC2 per run, so that the totals of the architectures stay apart.
- For each service of the architecture, choose Add service, select the region (US East, N. Virginia, or South America, São Paulo) and fill the configuration with the quantities of the workload: for EC2, the instance type, the usage in hours per month and the volume; for Lambda, the architecture, the number of requests, the duration and the memory; for Fargate, the operating system, the CPU architecture, the number of tasks per month, the duration, the vCPU and the memory; for S3, the storage and the requests.
- Save the estimate, copy the share link and export it as CSV to
estimates/<architecture>-<region>.csv. - Repeat for the other region.
The calculator does not know the workload, so it gives back exactly the quantities that it received. Its value lies in the unit prices and in the rules of each service that it applies, such as the free tiers and the minimum durations; the risk lies in a quantity typed wrong or a resource forgotten, which is why the estimate is checked against the model in code.
10. The cost model in code
The model of the lab, cost_model.py, turns each architecture into a list of lines, each one a quantity, a unit and a unit price taken from data/prices.json, and sums them. Writing the estimate in code makes it repeatable: a new measure of the workload or a new snapshot of the prices produces a new estimate in a second, and a test can check that a total equals the sum of its lines computed by hand. The excerpt below is architecture B, the instance started for each run.
elif arch == "ec2_scheduled":
rate, note = _ec2_rate(r, o)
hours = w["runs_per_month"] * max(60, w["run_seconds"] + o["boot_seconds"]) / 3600
lines = [
Line(f"EC2 {o['ec2_type']}", hours, "hours", rate, note),
Line("EBS gp3 volume (billed while stopped)", o["ebs_gb"], "GB-month", r["ebs_gp3_gb_month"]["usd"]),
Line("Public IPv4 address (only while running)", hours, "hours", r["public_ipv4_hour"]["usd"]),
_scheduler(prices, r, w["runs_per_month"] * 2, o),
_egress(prices, r, w, o),The page of the lab runs the same rules in JavaScript, in cost_model.js. To keep the two versions equal, cost_model.py --write-expected writes the totals of the five architectures in two regions, three pricing models, with and without free allowances and at three frequencies, 180 totals in all, and check_js.mjs recomputes them in JavaScript; the test of the package fails if any of them differs.
11. The five estimates
For thirty runs per month in us-east-1, on-demand and with the free allowances of the account, the five architectures cost from $16.55 to less than one cent per month. The largest line of each total shows where the money goes, and in every case it is a resource billed by time, not the work of the DataApp.
| Architecture | USD per month | Largest line |
|---|---|---|
| A · EC2 always on | 16.55 | t4g.small for 730 h, $12.26; the public IPv4 adds $3.65 |
| E · Fargate task + RDS PostgreSQL | 14.03 | db.t4g.micro for 730 h, $11.68 |
| B · EC2 started for each run | 0.66 | the volume of 8 GB, $0.64 |
| D · Fargate task + Scheduler + S3 | 0.05 | the image of 0.3 GB in ECR, $0.03 |
| C · Lambda + Scheduler + S3 | less than 0.01 | 150 S3 PUT requests, $0.0008 |
EC2 t4g.small 730.0000 hours × 0.0168 = 12.2640 on-demand
EBS gp3 volume 8.0000 GB-month × 0.08 = 0.6400
Public IPv4 address 730.0000 hours × 0.005 = 3.6500
Data transfer out to the internet 0.0000 GB × 0.09 = 0.0000 after the free 100 GBWithout the free allowances, C costs $0.11 and D $0.14 per month, because the 1,200 GB-seconds of thirty runs of forty seconds with 1 GB are then paid. The ranking of the architectures does not change.
12. Right-sizing
Right-sizing chooses the smallest resource that meets the measured demand with a margin. For tcg-dataapp the peak of 392 MB with 30% of margin needs about 510 MB, which a t4g.micro of 1 GiB holds; the t4g.small of 2 GiB first chosen doubles the memory without shortening the run, since the run waits for the network. In architecture A the change lowers the total from $16.55 to $10.42 per month, a saving of 37%. In C the same reasoning keeps the function at 1 GB; less memory would also give the function a smaller share of CPU, which Lambda allocates in proportion to the memory.
13. Scheduling and idle resources
The largest saving of the session comes from not paying for idle hours. Starting the instance for each run, architecture B, reduces the bill of A from $16.55 to $0.66 per month, 96% less, because the instance and its address are then billed for about ten hours a year instead of 8,760. What remains in B is the volume of 8 GB, billed while the instance is stopped. The public IPv4 deserves its own line in every estimate: since February 2024 AWS charges $0.005 per hour for each public address in use, which in A is $3.65 of a total of $16.55.
14. Commitments and the utilisation of break-even
A commitment lowers the rate of a resource that is used most of the time. In A, a reserved t4g.small for one year without upfront lowers the total from $16.55 to $11.96, and in E a reserved db.t4g.micro lowers it from $14.03 to $10.81. The decision depends on the utilisation of break-even, the ratio of the committed rate to the on-demand rate: 62.5% for the t4g.small and 72.5% for the db.t4g.micro (0.0116 / 0.016). A resource that runs fewer hours costs less on-demand, so a commitment for architecture B, whose instance runs 0.1% of the hours, would multiply its cost instead of lowering it.
15. Spot and idempotent loads
Spot lowers the price of an EC2 instance by the saving that the Spot Instance Advisor reports, 57% on average for t4g.small in us-east-1 on the day of the snapshot; Spot prices change, and the model treats this saving as an estimate. The cost of Spot is the possibility of losing the instance in the middle of a run. For tcg-dataapp the loss is acceptable, because the load of Lesson 7 replaces each batch inside a transaction and a rerun of the pipeline repeats only what failed, so an interrupted run can be retried without duplicating data. A DataApp whose load is not idempotent cannot use Spot safely.
16. Region and data residency
The same resources cost more in São Paulo than in Virginia: 1.48 times for A, 1.89 times for B and 2.09 times for E, while C and D cost a few cents in both. A region is chosen for more than price, however. The latency of the readers, the services available in the region and the contracts with the partner may require São Paulo. The LGPD does not forbid storing personal data outside Brazil, but it allows the international transfer of personal data only in the cases of its article 33, and a partner may require in contract that the data stay in the country. The ratio between the regions is the price of that requirement, and the estimate states it so that the partner can decide.
17. Storage classes and data transfer
A storage class with a lower price per gigabyte is not always cheaper. S3 Standard-Infrequent Access costs $0.0125 per GB-month in us-east-1 against $0.023 of Standard, but bills each object as at least 128 KB and at least 30 days, and charges each gigabyte read. The marts of tcg-dataapp are files smaller than 128 KB that are rewritten and read every day, so Standard-IA would cost more than Standard for them. Data transfer out to the internet costs $0.09 per GB in us-east-1 and $0.15 in São Paulo after the first 100 GB per month of the account; for a report read by a few people it is zero, but a DataApp that serves files to many readers must estimate it.
18. Sensitivity and the recommendation
An estimate is only as good as the quantities it assumes, and the ranking of the architectures changes with them. With 720 runs per month, one per hour, and 8,640, one every five minutes, the always-on architectures keep their cost while the architectures billed per use grow with the runs.
| Architecture | 30 runs | 720 runs | 8,640 runs | São Paulo, 30 runs |
|---|---|---|---|---|
| A · EC2 always on | 16.55 | 16.55 | 16.55 | 24.43 |
| B · EC2 started for each run | 0.66 | 1.08 | 5.87 | 1.24 |
| C · Lambda + Scheduler + S3 | less than 0.01 | 0.02 | 0.22 | less than 0.01 |
| D · Fargate task + Scheduler + S3 | 0.05 | 0.39 | 4.41 | 0.05 |
| E · Fargate task + RDS PostgreSQL | 14.03 | 14.37 | 18.39 | 29.25 |
For tcg-dataapp the recommendation is architecture C: a Lambda function on ARM with 1 GB, started daily by EventBridge Scheduler, with the DuckDB file and the marts in S3 Standard, which costs less than one cent per month with the free allowances and $0.11 without them, in either region. The recommendation stops being valid when the run approaches the fifteen minutes of Lambda, and then D is the next choice, at a cost of cents per month for a daily run.
19. The second hour: your architecture
In the second hour each group repeats the four steps over its own DataApp, with the fifth prompt of the lab. The group measures its workload, describes at least three architectures, estimates each one in the AWS Pricing Calculator in São Paulo and in Virginia, and writes the optimisation and the recommendation, with the monthly total and the condition that would change it. The lab accepts the workload and the unit prices of the group, so it serves as a second estimate to compare with the calculator, and its button "Copy as Markdown" produces a table ready for the documents.
docs/workload.md, with the origin of each quantity;docs/architectures.md, with a diagram and the billing dimensions of each architecture;- the estimates of the calculator, with their share links and CSV files in
estimates/; docs/cost_estimate.mdanddocs/cost_optimisation.md, delivered by pull request in the repository of the group.
20. The five prompts
[C] Character
You are the engineer responsible for the costs of the DataApp tcg-dataapp,
the package of Lesson 7. Before any price is looked up, the workload that
will be paid for must be measured, because every line of a cloud bill is a
quantity of the workload multiplied by a unit price.
[R] Request
1. scripts/measure_run.sh: runs `tcg-dataapp run` once under
`/usr/bin/time -v` with TCG_DB_PATH and TCG_OUT_DIR in a temporary
folder, and prints the wall time, the user and system CPU time, the
peak resident memory (MB), the size of warehouse/tcg.duckdb, the size of
out/ and the number of files written.
2. docs/workload.md: one table with the measured quantities and the
quantities that are decided, not measured (runs per month, readers and
their downloads, egress in GB per month), each one with its origin:
"measured on <date>", "assumption" or "decision of the group".
3. The bytes downloaded per run: the five price archives of tcgcsv and the
catalogue (HEAD requests are enough for the archives).
Facts measured on 08/11/2026 (confirm before use):
- wall time 25.6 s (Lesson 7 reference: about 40 s), CPU 10.8 s user and
1.1 s system, peak memory 392 MB;
- warehouse/tcg.duckdb 1.85 MB, out/ 0.09 MB (report.md and three
Parquet files);
- downloaded per run: 19.8 MB of archives and 1.8 MB of catalogue.
[E] Example
| quantity | value | unit | origin |
|---------------------|--------|-----------|------------------------|
| wall time of a run | 25.6 | s | measured on 08/11/2026 |
| runs per month | 30 | runs | decision: one per day |
[A] Adjustments
- Data entering AWS from the internet is not charged; record it anyway,
because it decides the duration of the run.
- Peak memory, not average, decides the size of the machine.
- Do not round the measures; round only in the conclusions.
[T] Type of output
The script, docs/workload.md and the output of one measured run.
[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.[C] Character
You are the same engineer. The workload is measured; now the architectures
that could run it on AWS are described by what each one bills.
[R] Request
docs/architectures.md with five candidate architectures for tcg-dataapp,
each one with a Mermaid diagram (scheduler, compute, storage, readers) and
a table of its billing dimensions (service, what is counted, unit, and the
quantity of the workload of docs/workload.md that drives it):
A. EC2 instance always on, with an EBS gp3 volume and a public IPv4.
B. The same instance started for each run and stopped after it, by
EventBridge Scheduler.
C. AWS Lambda (ARM) started by EventBridge Scheduler, with tcg.duckdb and
the marts in S3.
D. An ECS Fargate task (ARM) started by EventBridge Scheduler, with the
image in ECR and the data in S3.
E. D plus an RDS for PostgreSQL db.t4g.micro that serves the gold layer.
Close with a paragraph on the time that each architecture keeps a resource
billed while the DataApp is idle.
[E] Example
| service | counted | unit | driver |
|---------|----------------|------------|------------------------------|
| Lambda | compute | GB-second | runs x duration x memory |
| S3 | PUT requests | request | runs x files written per run |
[A] Adjustments
- Lambda stops a run at 15 minutes; say whether the measured run fits.
- Fargate bills per second, from the image pull to the end of the task,
with a minimum of one minute; EC2 Linux also bills per second with a
minimum of one minute.
- An EBS volume is billed while the instance is stopped; a public IPv4 is
billed only while it is in use.
[T] Type of output
docs/architectures.md, with the diagrams rendered in the preview.
[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.[C] Character
You are the same engineer. The architectures are described; now each one
receives a price, first in the AWS Pricing Calculator and then in code that
can be rerun when the workload changes.
[R] Request
1. A guide, docs/pricing_calculator.md, with the exact fields to fill in
https://calculator.aws for architectures B and D in the region
South America (Sao Paulo) and in US East (N. Virginia): service, region,
configuration and the quantities of docs/workload.md. The group fills
the calculator by hand, saves the estimate, copies the share link and
exports it as CSV to estimates/<architecture>-<region>.csv.
2. costs/cost_model.py: the five architectures as functions of the
workload and of a price table in costs/prices.json, with one line per
billing dimension (item, quantity, unit, unit price, cost) and the
monthly total; options for region, pricing model (on-demand, 1-year
commitment, Spot) and the free allowances.
3. costs/prices.json: every unit price with its source (AWS Price List
offer and usage type) and the date of consultation; nothing typed
from memory.
4. tests/test_cost_model.py: the always-on total equals the sum of its
lines computed by hand; Fargate bills at least one minute per run.
5. docs/cost_estimate.md: the monthly total of each architecture in both
regions, next to the total of the calculator for B and D, and the
explanation of any difference.
[E] Example
| line | quantity | unit | unit price | cost |
|----------------------|----------|-------|------------|-------|
| EC2 t4g.small | 730 | hours | 0.0168 | 12.26 |
| Public IPv4 address | 730 | hours | 0.005 | 3.65 |
[A] Adjustments
- The AWS Price List is public and needs no key:
https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/index.json.
The EC2 file of a region has about 480 MB; read the CSV in a stream and
keep only the instance types used.
- A month has 730 hours in the calculator; use the same.
- Prices in USD, without taxes.
[T] Type of output
The files, the output of pytest and the table of docs/cost_estimate.md.
[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.[C] Character
You are the same engineer. Every architecture has a price; now the
cheapest configuration that still meets the requirements of the DataApp
is chosen, and the choice is justified with numbers.
[R] Request
docs/cost_optimisation.md, using costs/cost_model.py:
1. Right-sizing: the smallest instance, Lambda memory and Fargate task
that fit the measured peak memory with a margin of 30%, and the saving
against the size first chosen.
2. Scheduling: the saving of B over A, and the share of the month in which
A is billed while idle.
3. Commitments: for A and E, the saving of a 1-year commitment and the
utilisation below which it costs more than on-demand
(commitment rate divided by on-demand rate).
4. Spot: whether a run interrupted in the middle is acceptable for this
DataApp, given the idempotent load of Lesson 7.
5. Region: the ratio between Sao Paulo and Virginia for each architecture,
and the requirements that may still demand Sao Paulo (latency of the
readers, data residency asked by the partner).
6. Sensitivity: the ranking of the five architectures with 30, 720 and
8,640 runs per month, and with ten times the data.
7. The recommendation in one paragraph: architecture, size, region,
pricing model and monthly total, with the condition that would change it.
[E] Example
| runs per month | A | B | C | D | E | cheapest |
|----------------|-------|------|------|------|-------|----------|
| 30 | 16.55 | 0.66 | 0.00 | 0.05 | 14.03 | C |
[A] Adjustments
- Compare monthly totals of the same workload; a saving is always in
USD per month and in percent.
- A commitment is paid whether the resource is used or not.
- Free allowances belong to the account, not to the DataApp: show every
total with and without them.
[T] Type of output
docs/cost_optimisation.md with the tables and the recommendation.
[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.[C] Character
You are the cost engineer of our group. Our DataApp already runs locally
as a package (Lesson 7) and its pipeline has a schedule (Lesson 8). Now its
infrastructure on AWS is estimated, compared and optimised before anything
is created in an account.
[R] Request
1. docs/workload.md: the measured workload of our DataApp (wall time,
peak memory, data stored, data written per run, runs per month, readers
and egress), each quantity with its origin.
2. docs/architectures.md: at least three architectures for our DataApp,
each with a Mermaid diagram and the table of its billing dimensions.
3. The estimate of every architecture in https://calculator.aws, in Sao
Paulo and in Virginia, saved with a share link and exported as CSV to
estimates/.
4. docs/cost_estimate.md: the monthly totals of the calculator side by
side, and one line per billing dimension of the cheapest architecture.
5. docs/cost_optimisation.md: right-sizing, scheduling, commitments, Spot,
region and sensitivity to ten times the runs and the data, closed by
the recommendation of the group with its monthly total.
[E] Example
| architecture | Sao Paulo | Virginia | ratio |
|-----------------------|-----------|----------|-------|
| Lambda + S3 | 0.00 | 0.00 | - |
[A] Adjustments
- Use the measures of our DataApp, not those of tcg-dataapp.
- Every unit price comes from the calculator or from the AWS Price List,
with the date of consultation.
- Include every resource that is billed while idle: volumes, addresses,
databases, NAT gateways and load balancers.
[T] Type of output
The documents, the CSV files of the calculator and the share links,
delivered in a pull request to the repository of the group.
[E] Extras
Show the plan before editing. Record this prompt in docs/prompts.md.
Stop at the end.21. Common mistakes in an estimate
- Pricing the machine and forgetting what it keeps billed while idle: volumes, public addresses, databases, NAT gateways and load balancers.
- Sizing by the average memory instead of the peak, which fails the run, or by habit, which pays for unused capacity.
- Comparing monthly totals of different workloads, for example one architecture with the free allowances and another without them.
- Buying a commitment for a resource that runs fewer hours than its utilisation of break-even.
- Choosing Standard-IA for small files that are read every day.
- Typing a price from memory or from an old page, without the source and the date.
- Presenting a single number without the condition under which it stops being valid.
22. References and self-study
- Amazon Web Services. AWS Pricing Calculator (self-study 1, 30 min).
- Amazon Web Services. AWS Pricing Calculator User Guide (self-study 2, 60 min).
- Amazon Web Services. Using the AWS Price List API. AWS Billing User Guide.
- Amazon Web Services. What are Savings Plans?
- Amazon Web Services. Spot Instance Advisor.
- Amazon Web Services. Cost Optimization Pillar, AWS Well-Architected Framework.
- STORMENT, J.R.; FULLER, M. Cloud FinOps. 2. ed. O'Reilly, 2023.
- BRASIL. Lei nº 13.709, de 14 de agosto de 2018 (LGPD), art. 33.