Created
March 23, 2019 08:21
-
-
Save Bio2hazard/9ded2c7056d5c7ab8c98526127a81d14 to your computer and use it in GitHub Desktop.
Cloudwatch Lister
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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