start	end	text
0	5900	He's giving the presentation on serverless log analysis on AWS.
6700	13280	Georges is an incident responder at Verizon Media where they have the chance to work on complex problems at scale.
13560	17980	He's originally from Greece and has been living in the U.S. for the past four years.
18480	24040	They got their Master's in Cyber Security from Stevens Institute of Technology in Hoboken, New Jersey
24040	30190	and hold the GCIH and GNFA from GIAC.
31380	36420	Please give a Blue Team Village warm welcome to Georges.
40560	42560	Thank you.
42560	46260	Wait, because I have a loud voice, let me fix this.
46420	48740	Hey everybody, how are you all doing?
48740	53860	Alright, we're going to talk today about serverless log analysis on AWS.
53860	57680	Hopefully I'm not going to keep you long so you can go to the parties afterwards.
57720	59500	Hope you guys are having fun.
61680	67760	I'm Georges, as it was said, I'm an incident security engineer at Verizon Media.
67760	75260	I work for the Paranoids Fire Team, which we are the forensics incident response engineering team.
75260	77500	This is my handle if you want to follow me on Twitter.
77960	82960	And also I am a first time speaker, so if I am saying or anything like that, it's because of that.
84240	86700	So, first of all, why are we having this talk?
86700	91920	We're having this talk because of all the security challenges that we have on the cloud.
92060	95400	And as a result, the different challenges that we have on the cloud, right?
95400	98640	So, everybody wants to move on the cloud.
98640	105480	Either because it might be because of auto scaling or because they want more space or they need more power.
105480	108420	They have all the infrastructure they want to move to the cloud.
108440	110440	Everyone wants to move to the cloud.
110480	116200	And then where the problem comes in because engineers are still learning the tech stack of the cloud.
116200	121280	And all the new services that companies like Amazon or Google are spinning up all the time.
121280	123960	So, they're not able to keep up.
123960	126200	Sorry for that.
126780	131400	And also, my last point in this slide is what about cloud security?
131400	140140	Because everything in IT, as far as I know, is built up without security in mind in the beginning.
140140	142140	So, we have to build up on it.
142180	143780	So, yeah, everyone wants in.
144980	147880	And then we have fails all the time.
147880	157100	Because people do git repos that have AWS keys and they copy the AWS key on the git repos.
157100	164900	And actually, there have been a lot of critical incidents out there that have been because of that.
165000	175180	Like, I don't know if you guys hear, two weeks ago, a big bank, I'm not going to call the name, had a security incident because of some AWS keys that were exposed.
175180	177100	I'm not going to say more about that.
177100	185240	Then we also have security groups because of misconfigurations, other AWS resources misconfigurations that always bring up problems.
185420	189540	But what happens even if we have amazing cloud security teams?
189540	192500	What happens if our engineers are amazing at what they're doing?
192500	193880	We still have fails.
193880	197480	Even if we have the pros defending us, we still have fails.
197480	198540	Why is that?
198540	203420	Because we always have the server-side vulnerabilities that are never going to go away.
203420	208440	We have SSRFs, RCs out there, anything in the OWASP top 10.
208440	215740	Anything out there that can lead to exposures on our prem environment, but also on our AWS environment.
216160	219720	Does anyone recognize this IP over here that I have on the bottom?
221120	225620	If you don't, this is the metadata service that AWS has.
225620	234200	Essentially, if you get an SSRF on a host that is hosted on AWS, you're going to be able to get a lot of information out there.
235200	239640	Potentially, AWS keys are going to give you access to the rest of your environment.
241760	245460	With that, we know that our environment is going to get compromised.
246100	249020	Whatever we're going to do, it's going to get compromised at some point.
250360	255780	Apart from the defenses, which I'm not going to talk about anything about security defenses in this talk, we need the forensics.
255780	260140	We need to know the artifacts. We need to know where all our logs are.
260640	264940	We need, first of all, to enable logging, right? Because some people do not even enable logging.
265120	267520	We need API logs, access logs, and even more.
268620	270980	So, here I come to the CloudTrail.
271140	275620	Who out here knows what CloudTrail is? Let me see hands. Awesome.
275620	283080	So, CloudTrail essentially is a service that records all the API calls or any other AWS actions that happen on your AWS environment.
283080	289400	It records all the activity from EC2, it can be security group changes, anything that happens on auto-scaling,
289400	292620	like if it's EC2 instance that's been up or shut down, anything like that.
292620	295700	Or all the other services that you see here that I list.
296040	299960	So, by default, it's enabled for up to 90 days.
299960	303640	And you can actually really easily access it if you have a single account.
303640	307460	You can go to the CloudTrail service and access these logs.
307460	313980	They're going to have everything that happens in your environment, apart from host-based logs or network logs, etc.
313980	316520	It's just for your AWS resources.
317600	324420	So, apart from that, you can store these logs on an S3 bucket and keep them longer in time.
324420	329340	And then potentially, depending on your policy, you can store them there for six months, a year,
329340	331820	I don't know, whatever your policy for retention.
331820	336580	And then you can even move them on cloud storage on AWS.
337240	342080	So, some of the most important artifacts, and this list is not inclusive,
342080	346820	but this is just some of the artifacts that we need to know on AWS.
346940	350360	For example, we can catch script kitties with a user agent,
350360	353920	because if there's a script kitty attacking our environment,
353920	357260	you're going to see potentially malicious or weird-looking user agents
357260	360300	making changes in your environment or accessing your environment
360300	364620	that you probably shouldn't have, right? And it's something you need to investigate.
364720	371560	Then you have, in every CloudTrail log, you have a source IP address,
371560	373640	which, of course, you can keep in inventory.
374140	378860	It's a good practice to keep an inventory of the IPs that normally access your AWS environment.
379200	383660	And then if you see something odd, a new IP or something like that, you should investigate.
383660	386440	It might be like a developer working from home or something like that,
386440	388040	but you definitely need to investigate.
388200	390480	Then we have the event name and event source,
390480	392800	which, of course, define what you're looking at,
392800	399880	and the user identity logs that are going to essentially identify the identity
399880	401780	behind the actions that are happening.
401820	404580	Then I want to really point out the response elements,
404580	407780	because it's going to make sense also while we go forward in this talk.
407860	410940	The response elements are going to be in your CloudTrail logs
410940	413820	only when there is a change in your environment.
413820	419560	So if you see someone on the CloudTrail logs trying to make changes on security groups,
419560	422640	but you don't see a response element log in there,
422640	425760	like if the field be having some information, it means that they failed.
425760	426880	It didn't make any change.
426880	429740	But if you see the response elements field have information there,
429740	432680	it's going to have all the changes that have been made there.
433000	435220	And also, last but not least, their code.
435220	438020	Their code field in CloudTrail log is really important,
438020	443240	because there you're going to see any access denied activity
443240	447840	or any user that was not supposed to access some resources,
447840	449720	is going to have an error code and you're going to find it there.
449720	451820	It's a good indicator of something's wrong.
452720	458140	So now let's talk about the traditional methods of doing log analysis on CloudTrail logs.
458140	460320	And I want to ask a quiz over here to the crowd.
460600	465780	So who from over here has actually done investigations on CloudTrail?
465780	469020	All right. Not too many.
469020	474060	But who of you use grep or jq or any other command line tool?
474940	476100	All right.
476480	479480	Who of you have a NELT stack that just sends a log there?
479820	481700	Okay, so we have half and half.
481780	490380	So for the ones who use grep or jq or any other command line tool, it's amazing.
490380	494300	It's really cool to have that knowledge and do that on the command line.
494300	498840	But it's also like all these CloudTrail logs are already stored on an S3 bucket.
498840	503040	And you just go and download them locally or on a server to do analysis.
503100	508000	First of all, it's costly to download from the S3 bucket if you want to go download 10 or 20 gigabytes of logs.
508000	510020	And then also it's more time consuming.
510220	518040	Then for you people who have a NELT stack set up or use, for example, AWS Elasticsearch service, which is amazing.
518220	521200	This is amazing, but it's so costly.
521280	522700	It's so costly.
523260	527580	Then you can also use CloudWatch, which has some limitations.
527620	537380	Or if you have a lot of money, I don't know who you work for, but if you have a lot of money, you can use AWS logs to be sent to your SIEM and pay all that money.
537540	541120	But wait, why did we come over here this late on Friday?
541120	546600	To discuss about something that is most efficient, that it scales, and it's fast.
547960	555600	So how we do actually AWS logs at scale at Verizon Media is that we have somewhere about...
556300	562560	I'm going to just say that we have more than 1,000 accounts, AWS accounts, more than 1,000 AWS accounts.
562560	563960	I'm not going to say the exact number.
564280	567460	So we have to find a way to manage all this, right?
567460	570760	And if we want to do an investigation, how are we going to find all these logs?
570760	581300	So what we suggest that you also guys do, if you have more than tens or hundreds of accounts, you need to have all the different account owners send the logs your way.
581300	588360	You need to have a centralized security AWS account that you're going to have all the logs centralized, like a SIEM, right?
588460	591420	It's going to sit on AWS on an S3 bucket.
591480	597860	So you're going to have them all pointed to your S3 bucket, and you're going to have them stored locally, where you're going to keep backups.
597860	602760	You're going to have them encrypted with a key that they send with you, et cetera, et cetera.
603220	607920	Okay, um, first of all, please encrypt. Don't have the logs just sitting there.
607920	610220	Because they're really valuable for an attacker as well.
610220	620360	Like, they may not, uh, exploit, like, uh, breach, do another breach, but if they find your logs, that's a really good resource for them.
621120	624400	So yeah, so we have them, let's say that we did that, and we have them all centralized.
624400	625420	What do we do now?
626600	637620	So, for you who don't know, Athena is actually an ancient Greek goddess of wisdom, and it happens to also be a serverless query service in AWS.
637960	640360	So Athena is amazing, actually.
640400	650500	It lets you query structured data that are stored in an S3 bucket, and the only thing you need to do is to point it to the right direction, and still do all the magic.
650500	655620	I mean, no, really, she will do all the magic, but there are some details that we're going to talk about.
656060	657400	So how it works.
657480	662320	So you first need to have your logs stored in an S3 bucket, and wait.
662320	666120	We already have these logs, the CloudStory logs, in an S3 bucket already stored.
666120	667240	We don't need to do anything.
667300	677960	We just need to point Athena in the right direction, then define the schema in a create table query, which is actually already, you don't need to do anything.
677960	680980	You don't need to know Hive or create table queries.
680980	682440	It's already in AWS.
682600	687480	If you search create table CloudTrail, you're going to find the query ready for you.
687480	694580	The only thing you need to do is to change the location of the logs that you have, and also name your table the way that you want to name it.
694580	700580	And what Athena does, essentially, is look at the logs, query them, and create a table for you.
700580	702860	So what do you need to do afterwards to do your investigation?
703060	704000	Just SQL.
704220	705180	You don't need anything else.
705180	709080	You just go to Athena, use SQL, and do your investigation.
709080	712740	No downloading, no Elk Stack, no big money.
714240	717340	And as we said, so Athena is a serverless service.
717340	719820	You don't need to spin up anything, no instances.
719860	722460	It's fast, it's cost efficient, and scalable.
722580	725440	It's actually really, really, really cheap.
725480	727480	It's $5 per terabyte.
727520	731560	And if that doesn't make a lot of sense to you, what is $5 per terabyte?
731560	736020	Essentially, what AWS does, they charge you per query.
736340	737920	And I'll give you an example.
738400	746440	If you run, let's say that you have some monitoring on your CloudTrail logs, and you have Athena looking at it.
746520	753940	Like, if you want to search one gigabyte, which wouldn't be the case at all, where you have way less amount of data scanning on CloudTrail.
754340	758000	Every hour, for 24 hours, for 30 days.
758000	762220	So again, one gigabyte of logs, 24 hours, for 30 days.
762220	766120	It's only going to cost you $3.56.
766860	771640	You know how much it would cost you to just have an ELK stack, just sitting there, not doing anything.
771640	773500	Just have an ELK stack on the Cloud.
774860	776420	$150 for a month.
776420	778420	Just sitting there, not doing any analysis.
778480	780160	Imagine doing the analysis as well.
780200	781960	It's really cheap, it's really efficient.
782020	784020	It's essentially a Cloud Presto.
784020	789480	And it's available through the AWS console, which you're going to see right after in my quick demo.
789480	792560	Through an API, and also through AWS CLI.
793260	801280	So essentially, the framework that I'm suggesting today to all of you, to go back home and work with your teams, and hopefully implement it.
801360	803980	And you're going to see how I implement it on the demo.
803980	809280	It's a cooperatively framework for teams to work together.
809280	816380	You essentially have a space that you can save queries in AWS Athena, and other analysts can reuse, make them better.
816420	818800	They don't need to have essentially any SQL skills.
818800	825780	They just need to have someone who creates an amazing SQL query for investigations, and you just go back and reuse them.
825780	834560	Then management actually has great oversight on your investigations, because Athena stores your queries for 90 days.
834560	839600	So let's say that you work on an investigation, and your management wants to check out your results.
839600	845680	You give them a report, but they can also go in Athena and see the results from your queries, and what queries you run.
845920	847660	For back to 90 days.
847660	851620	And essentially, AWS doesn't even make you run the query again.
851620	856880	It stores the query, and you can just click on the query, and access the results.
857220	858260	That simple.
861500	862760	I said all that?
862760	863680	Let's go to the next one.
863680	867940	So over here I have some sample queries for different type of investigations for you.
867940	874820	The first one on the top is going to be a query that we look for, as I talked about before, about error code.
874820	880280	So we can look for unauthorized operations in AWS resources, or access denied.
880380	886840	Then the second one, that's really important, that actually we could use on the breach that happened two weeks ago.
886840	893760	We look for a specific key that potentially has been compromised, or that we know that was exposed.
893760	896600	And we can see all the activity that happened through that key.
896600	904340	And as you see, over here, I have the database and the table, because these queries are on my saved queries tab.
904440	907580	So I save all the queries for other people to use in my team.
907640	909620	And then this is just a placeholder.
909620	914600	Every time you can change the database, the table, and just put your key that you want to look for.
914600	920140	Then the last one just looks for changes in security groups.
920940	929780	Next, actually I should have put that slide after the next one, because I haven't already said that we can use Athena for other logs.
929800	935300	But over here, as you can see, the first one just checks for console logging on your AWS resources.
935520	940700	And then the next two, as you're going to see on the next slide, you can use AWS Athena for more than CloudTrail logs.
940700	947200	You can use AWS Athena essentially for any structured logs that you may have on AWS or you want to put on AWS.
947200	950200	So the first one looks at Apache Access logs.
950200	956020	And you can see at a path traversal tag to find a password essentially on a web server.
956020	960260	And the second one, you look for your string that you want to look.
960640	969540	Maybe it could be in a SQL injection or an XSS or anything that you want to look at your Apache Access logs that has a response code of 200.
970520	973020	So here I just talk about this.
973180	976040	Athena can work with any type of logs that you want.
976040	977960	As many logs as you want.
977960	980540	They just have to be in a structured way.
980540	982420	You just need to define the schema.
983000	986440	Some of them, maybe most of them, are already out there.
986440	990080	People have the schema. AWS has the schema for a lot of them.
990080	996200	Or if you have a custom log or something that you couldn't find, you can just define the schema.
996200	1002160	By schema, I mean you just need to define the different columns and the different fields that your logs have.
1003720	1005140	Let's go to the demo.
1005300	1007500	Let's see if this video is going to play or not.
1013440	1014180	All right.
1014180	1017160	So here I'm just on the AWS console.
1017680	1020280	And we can easily access Athena.
1020360	1025660	You just find it on your history if you used it before or just click Athena on the services tab.
1026840	1030020	So now we are inside Athena from the console, right?
1030020	1033960	On the right, you see the query editor, which over here you can write your queries.
1034040	1036840	And you can write, I think, up to 15 queries at the same time.
1036840	1038260	And we're going to see that afterwards.
1038460	1040300	On the left, you have your databases.
1040420	1043160	This is a personal account, so I don't have a lot of databases enabled.
1043320	1049960	But essentially, what I recommend over here for you guys to do is to have a database with its different type of investigation.
1050060	1052700	For example, you have a database that is called CloudTrail.
1052700	1055000	A database that is called Apache Access Logs.
1055580	1058300	A database that is called ELB Logs.
1058300	1060900	And then you have a table for each of your investigations.
1061840	1065880	And you can call the tables the name of your particular investigation.
1065880	1068820	Over here, we have the safe query tabs, which I already spoke about,
1068820	1076380	which we can have senior analysts or amazing SQL engineers that you may have on your team create really good queries
1076380	1080980	that then your team can reuse in the future to perform investigations.
1080980	1082920	They don't need to come up with their own queries.
1082920	1084200	They have them over here.
1084200	1085840	It's just so easy.
1086440	1093880	And then the only thing that you need to do is to select the query and just change the placeholder that I have in each one.
1093880	1097680	That is going to be the database and the table and the location.
1097720	1100620	Not the location, sorry. I'm going to talk about the location right after.
1102180	1103580	Let's move a little bit.
1103700	1105860	And then there's the history tab.
1105860	1109660	So in the history tab, you have all the queries that you ran for the past 90 days.
1109720	1114800	So these queries are saved with the results in a new S3 bucket, actually.
1114800	1117720	And you can access them within 90 days.
1118000	1122260	And the amazing thing about it is that you won't have to run it again.
1122260	1123540	The results are over there.
1123960	1128900	And as you see on the encryption type field, I have them all encrypted.
1129020	1131120	This is really, actually really important.
1131120	1133060	It's a rookie mistake that I did in the beginning.
1133480	1136680	You have to go to your settings right here on the top right.
1136960	1138580	It's not going to look like that in the beginning.
1138640	1139720	It's going to look like this.
1139720	1147640	If it's like this, it means that when you run a query, even if your CloudTree logs are encrypted, your results are going to be in clear text.
1147860	1155360	You need to make sure that you enable this and select the KMS key that you already have to encrypt your CloudTree logs.
1155440	1159060	Otherwise, we are failing as security folks, right?
1159540	1164520	Okay, so now let's go back to actually, let me stop this so I can explain.
1164580	1167160	This is a personal AWS account that I had.
1167160	1169400	And I used an amazing project out there.
1169400	1177740	If you want to test attacks on AWS and defenses and CloudTree logs in Athena, it's called CloudGoat.
1177740	1181480	It's on GitHub. It's an amazing project by some amazing folks.
1182200	1184820	They have some CloudFormation scripts.
1184860	1186620	And again, it's called CloudGoat.
1186620	1190280	That you can create a vulnerable AWS environment.
1190280	1193480	And then they have even the scenarios for you to run attacks.
1193480	1194300	Different types of attacks.
1194300	1198540	I think they have five or six different scenarios that you can attack them.
1198540	1201820	So then I created an environment in my own personal account.
1201820	1203960	I didn't want to use our corporate data, of course.
1204720	1210040	And then I performed a scenario so we can have the logs to see how this works.
1210220	1212740	So first of all, let's go and create the table.
1212740	1214240	We already have the logs.
1214720	1218840	And this is the create table query that is already in AWS.
1218840	1220420	You don't need to create that, right?
1220680	1222920	It's a Hive query that creates a schema.
1222920	1226160	And the only thing you need to do is over here at the bottom.
1226320	1229700	I just did it really quick because I edited the video.
1229780	1233180	You just need to change the placeholders.
1233180	1235260	Which is going to be like the account number that you have.
1235260	1236200	The location.
1236220	1236880	The region.
1236880	1242260	And the date that you want to actually tell Athena to go and create a table from these logs.
1243400	1245860	So over here, really quick, run query.
1246100	1247440	My table was created.
1247440	1254420	And then you can go and check preview table to see if actually your table was created or if there was a mistake.
1254680	1256340	And sometimes there are some mistakes.
1256900	1261560	Most of the time you just need to switch the schema.
1261560	1265460	And over here at the left, you can see the schema essentially of your table.
1265460	1269760	Which is all your different fields on CloudTrail.
1269760	1270680	That's what it is.
1270680	1273180	And each of these is a column on your table.
1274200	1275040	So perfect.
1275040	1283720	So in our scenario, we're notified that there's this user named Solo that had some suspicious activity happening on his account.
1283840	1287080	So we have from our... this happened really quick.
1287080	1288240	Wait, let me go back.
1288360	1289420	Let me go back.
1289760	1295780	So you see, I went to saved queries and I selected the user activity query that I already have there from my senior guy.
1295780	1297300	Because I don't know SPL.
1298400	1299620	So I select this query.
1299620	1305620	And the only thing that I need to do as a junior analyst is just change the user name that I'm looking at.
1305620	1310200	And also change the database and the table that I want to query.
1311120	1314160	And as we're going to see here...
1321740	1325400	I didn't get some results because I had principal ID and I had to change it.
1325480	1326860	I didn't edit it on the video.
1326860	1329700	So I'm just looking at the user identity dot user name.
1329700	1331880	Because user identity is a struct.
1332020	1334720	Oh, sorry about that.
1335280	1336460	Why did that happen?
1337600	1338460	Okay.
1338460	1340220	And we get only two results.
1340220	1348240	And we see that this user Solo was actually accessing some code build projects and listing the projects.
1348240	1349420	Why would that be?
1349920	1351880	So we don't know exactly what happened.
1351880	1354440	But we see there's a source IP address over here.
1354440	1357940	So we're going to check if there was any other actions based on that IP address.
1357940	1359180	So we copy it again.
1359180	1364220	We go to our saved queries that we have for looking for suspicious IPs.
1364300	1366340	I already have put it in here.
1366360	1367660	Run the query.
1367740	1370340	And we're going to get all the results that came from that IP.
1370340	1373020	So we pivoted from user Solo to that particular IP.
1373020	1377240	And we see, oh, there's so many different logs over here.
1377420	1379380	Let's first sort it by time.
1379380	1383860	And then we see that from this IP, actually, first user Solo was accessed.
1383860	1385400	But then something else happened.
1385400	1388220	User Calrissian, another user, got accessed.
1388260	1392180	And you see some actions over here in the event name create DB snapshot.
1393620	1400140	So they are creating a snapshot of one of our RDS databases.
1401040	1402180	This is serious.
1402240	1403940	So let's see what's going on afterwards.
1404440	1410520	And if you go down in the logs, I didn't have time to do, like, a really thorough demo.
1410520	1417120	But if you see down here at the bottom, you can see actually that the user was actually able to,
1417120	1421680	I was a user with Cloud Go, to create a snapshot of our database,
1421680	1426480	because the user Calrissian who accessed the credentials had those permissions,
1426480	1429500	and then changed the master password to that database.
1429500	1434540	So then he had access to our secret database with all our secrets over here.
1434600	1438940	And we can see all that in the Cloud Trail logs, all the actions,
1438940	1441040	and we can query them really easily with Athena.
1460980	1463460	Let's see how I can put it back into presentation mode.
1465200	1467200	Anyways, you'll see my bookmarks too.
1469020	1472840	So, apart from all this, right, what else can we do?
1472840	1475440	We can do threat hunting, we can automate all this.
1475440	1478860	We can have queries that are used for our threat hunting activities.
1478860	1486960	We can have automated hunting to be in place using step functions in AWS and Lambda functions.
1486960	1491140	So essentially what step functions is, for the people who don't know,
1491140	1497840	is essentially putting together all your serverless resources, working together.
1497840	1502300	So you can, it's like, if you think it as an orchestration tool.
1502300	1507800	You can have Athena querying your logs, and then getting the output to a Lambda function,
1507800	1512340	and then the output from the Lambda function back again to Athena to create another table, and so on.
1513120	1516580	And something that I didn't add in this presentation, actually, that I want to mention,
1516580	1521700	is that you can even have really amazing diagrams come out of this using QuickSight.
1521740	1524800	Check it out. I didn't add it in the presentation, but it's something that you really should look at.
1524800	1529260	It's called QuickSight, and you can feed the results from Athena to QuickSight
1529260	1532000	and get some really cool diagrams after that.
1532000	1536260	And I want to talk also about a suggestion to you guys.
1536640	1542480	Even if you want to use AWS Athena or not, a really cool way to track up use the STS keys.
1542520	1550780	So what STS keys is, the temporary credentials that actually AWS creates and assigns to your EC2 resources,
1550780	1554080	which is created automatically, and it's assigned to an EC2 instance.
1554080	1559080	It's not going to be created by you, and they're temporary. I think the default is six hours.
1559080	1566080	So these credentials are actually the ones who we see mostly being abused in the wild.
1566080	1571160	Because these are the credentials that someone is going to take advantage using an SSRF attack on your environment.
1571320	1577780	So the way that we can track it, even if we don't know that something was exposed on a GitHub page or something like that,
1577780	1582960	we can find all the Assumeral logs in our CloudTrail logs.
1582980	1589060	And when we have an Assumeral event, that means that a key was assigned to an EC2 instance.
1589060	1596300	Then normally what would happen is that that key would only be used by that particular EC2 instance.
1596540	1602040	Sometimes developers do some funky stuff, so you might see some edge cases, but normally it's what happens.
1602140	1607960	Then if you look at the AssumedRole events, you're going to see where that particular key was used.
1608040	1615400	So if we don't have an edge case with a developer, and we see a key being used with an AssumedRole event
1615400	1620580	from a different IP or a different EC2 resource, then this is something we need to investigate.
1620580	1626660	So please, if there is one takeaway that you need to take from this, this is the one you need to take and look at your environment.
1627660	1630680	So we can make it even faster, right?
1630760	1642220	If we partition the data that we have on CloudTrail, in some cases you can make it even 99% better and up to 90% cheaper.
1642220	1650380	We can compress and split the files, bucket your data, optimize file sizes, and then also just optimize your SQL queries as well.
1651480	1657900	In conclusion, AWS Athena is fast, cost effective, and easy to use.
1657900	1663080	And I hope that each and every of you consider it, go play with it.
1663080	1668880	I definitely recommend setting up a personal account using Cloud Go to create the logs that you can look at afterwards
1668880	1675560	and start doing some investigations on your own and then potentially bring it to your organization.
1676280	1681280	Thanks, that was my talk, and if you have any questions, you can ask me here or later.
1697710	1700060	So, you're talking about the history?
1701550	1707590	So, Athena history is right now, AWS has it only for 90 days, the history.
1707590	1716290	But then, if you would want, you could go to manually then on the S3 bucket that they are stored and move them somewhere else.
1716330	1719650	But on the dashboard, you're only going to see it for 90 days right now.
1719650	1724550	I looked for that, they don't have that. They just have for 90 days the history.
1731880	1733600	So, it's data scanned.
1733600	1738400	Yes, and most of the time, you won't reach one terabyte of cloud trade logs, right?
1738400	1747900	In most of the cases, the case that I worked at has been like, I don't know, 5 gigabytes if you look for a month, maybe 10 gigabytes, which is going to be really, really cheap.
1747960	1748660	Really cheap.
1752010	1755470	So, it counts the data that you query.
1755610	1764070	So, that's why I say over here, I say partition your data, because if you go and scan your whole account for the whole year, it's going to be 100 gigabytes.
1764070	1773450	But if you partition the data and you specify that I want to look for those days, for those 10 days, it's going to be 10 times less.
1773470	1776490	So, yeah, it's per data that you scan.
1796880	1799780	Yes, so the best format is Parquet.
1800320	1804660	You can scan any other data, like JSON, any other type of data.
1804660	1807840	You can have zip files, anything, but Parquet is the best.
1807840	1810540	So, AWS recommends to boot it on Parquet, yes.
1813340	1815280	Ah, that's a tough question.
1815740	1818520	It might be JSON. I'm not sure. I know that the best is Parquet.
1818520	1819600	Maybe JSON.
1821800	1822400	We're good?
1822740	1824020	Thank you so much, guys.
1826200	1826940	Thank you.
