Instructor: So let's have a look at cost allocation tags.
So they're used to track your AWS costs on a detailed level.
So this is the kind of report you would get
if you download your cost and report.
And then, as you can see,
you have a column name, Total Cost,
and then you have a bunch of different colors, ah columns,
user:Owner, user:Stack, user:Cost Center, user:Application,
and they are cost allocation tags, okay.
This is because you wanted to separate your cost report
based on the different values of these tags.
So you have two types of tags for cost allocation tags.
You have AWS generated tags and they automatically
are applied to the resource you create
because they are generated by AWS.
And they will start with a Prefix AWS.
For example, this Prefix AWS column, createdBy,
is very important.
That represents who has created a specific resource.
And so you could create a cost report
based on who has created what.
And so you can incur cost back to a specific person.
Now, user-defined tasks, ah tags, are defined by the users
and they start with the Prefix user colons,
just as the one on the table on the right hand side.
So, let's go in the console to see how we can define
these cost allocation tags and use them.
So, on the left hand side of your Cost Management,
you have Cost allocation tags.
And as we can see, we have two options.
We have the User-defined cost allocation tags
and the AWS-generated cost allocation tags.
So, if you go in here for example,
and we wanted to enable this aws:createdby tag,
we could activate it,
and then once it's activated
is going to be taken into account
when generating cost report.
So as you can see,
you have a bunch of different generated tags,
for example, cloudformation:stack-id, and so on,
if you wanted to.
Next, for User-defined cost allocation tags,
this is if you wanted to define your own tags.
For example, say you're using Environment
for dev test and prod,
and you wanted to separate your cost by environment.
In this case, you could activate, again,
a User-defined cost allocation tag,
and this would be up to you of course,
to use that tag properly.
So, if you go into the EC2,
and we're going to launch an instance directly,
so let me show you what I mean by that.
So, we're going to launch an instance.
And then Amazon Linux 2,
t2.micro,
And then on the tags side,
here, I'm supposed to use the Environment tag,
for example, Developments,
and this is where that tag would be picked up
for cost allocation purposes, okay.
So, I'm now going to go ahead and create this instance,
but you see that you need to start tagging your resources
with your correct tags for them to appear, obviously,
and be separated in this cost allocation tags reports.
Which brings us to the cost and usage reports.
So this is a report used to dive deeper
into your cost and usage.
And it contains the most comprehensive set
of AWS cost and usage that available.
This includes all the additional metadata
about your services, pricing, and reservations.
So, you will get some information
about the Amazon EC2 Reserved Instances in there.
So, this cost and usage report will list the AWS usage
for each service used by your accounts
with hourly or daily line items.
And any tags you have activated
for cost allocation purposes.
And this is why cost allocation tags are very important.
You can configure it to do daily exports into Amazon S3.
And then you can analyze this data
using Athena, Redshift, or QuickSight.
So, to get that report,
on the left hand side on Cost and Usage Reports,
I can create a report.
And then we can, say for example, DemoReport.
We can include resource IDs if you wanted to.
And then automatically refresh this report if we needed to.
Then we need to set up an S3 bucket
to deliver this bucket, this information to.
So we can do it, demo-cost-report-stephane,
and we'll use the Region US East Northern Virginia.
Next.
And then we confirm the default policy that would be applied
to the buckets to allow the delivery of these reports.
We could say the time granularity that we want,
for example, Daily.
And whether or not we want to Create a new report version
or Overwrite existing reports,
so I'll Create a new report version.
Then we can enable the integration
with Athena, Redshift, and QuickSight if we wanted to,
as well as a specific compression mechanism.
Click on Next, and we'll see, I'll call it costreports,
as a Prefix.
Next.
And then Review and Complete.
And this will enable the delivery of this report
directly into your S3 bucket, every day.
Another thing you can do is to,
you can enable some of these reports
and they can take up to 24 hours to be enabled, okay.
But you can start analyzing your costs using Cost Explorer.
And you would use the same cost allocation tags as before.
You can monitor your RI's using Cost Explorer,
or you can get a AWS Usage Report,
and this could be based for any kind of service.
For example, let's do a service that we all know,
such as Amazon EC2.
Which is right here.
And then All Usage Types,
for the Current billing period.
And the Granularity is, let's do for last month,
and the Granularity is by Days.
And then let's Download this report.
Which is a CSV.
And here I am getting my report of the Operation,
the UsageType,
the Service,
and so on, as well as StartTime,
the EndTime, and the UsageValue.
So this is a really, really big report as you can see.
And when I do have my cost allocation tags in place,
because they can take a little bit of time to populate,
then I will start seeing them as well in this report.
So that's it for this cost lecture.
I hope you liked it.
And I will see you in the next lecture.