Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (5.6k points)
I want to know that how much GuardDuty is going to cost me per month. As per the AWS documentation, I should check how many cloud trail logs I produce in a month along with the VPC logs in a month.

Now, using boto3 S3 I can estimate how much I'll be spending having GraudDuty read my logs. But I can't figure out from where I can find how much amount of data(in GB) mu VPC logs are producing.

So I want to do it programmatically to check my VPC log flow that I produce in a month to estimate how much I can spend on GraudDuty.

1 Answer

0 votes
by (12.4k points)

Providing the code snippet to check how to get the size of your VPC flow, you need to modify the below code to get logs for the entire month.

import boto3

logs = boto3.client('logs')

# List the log groups and identify the VPC flow log group

for log in logs.describe_log_groups()['logGroups']:

  print log['logGroupName']

# Get the logstreams in 'vpc-flow-logs'

for log in logs.describe_log_streams(logGroupName='vpc-flow-logs')['logStreams']:

  print log['logStreamName'], log['storedBytes']

describe_log_streams

Do you want to learn more about AWS? Checkout AWS Training by Intellipaat! 

Related questions

0 votes
1 answer
asked Mar 14, 2021 in AWS by devin (5.6k points)
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...