Skip to content

Instantly share code, notes, and snippets.

@Bio2hazard
Created March 23, 2019 08:21
Show Gist options
  • Save Bio2hazard/9ded2c7056d5c7ab8c98526127a81d14 to your computer and use it in GitHub Desktop.
Save Bio2hazard/9ded2c7056d5c7ab8c98526127a81d14 to your computer and use it in GitHub Desktop.
Cloudwatch Lister
using System;
using System.Threading.Tasks;
using Amazon;
using Amazon.CloudWatchLogs;
using Amazon.Extensions.NETCore.Setup;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var awsOptions = new AWSOptions {
Profile = "assume-myteam-myrole",
Region = RegionEndpoint.USWest1
};
var cloudWatchClient = awsOptions.CreateServiceClient<IAmazonCloudWatchLogs>();
var logGroupsResponse = cloudWatchClient.DescribeLogGroupsAsync().Result;
logGroupsResponse.LogGroups.ForEach(lg =>
Console.WriteLine($"Size:{lg.StoredBytes:N0}, Retention:{lg.RetentionInDays} , Name:{lg.LogGroupName}, Arn:{lg.Arn}")
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment