Skip to content

Instantly share code, notes, and snippets.

@tnayanam
Created August 23, 2019 00:38
Show Gist options
  • Save tnayanam/f14efaa28926747dfd7d8c30039115f0 to your computer and use it in GitHub Desktop.
Save tnayanam/f14efaa28926747dfd7d8c30039115f0 to your computer and use it in GitHub Desktop.
using Amazon;
using Amazon.CloudWatchLogs;
using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading;
namespace ConsoleApp16
{
class Program
{
static void Main(string[] args)
{
try
{
Console.WriteLine("----AWS4---- ");
string endpointUrl = "http://169.254.169.254/latest/meta-data/";
Uri myUri = new Uri(endpointUrl);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myUri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
Console.WriteLine(reader.ReadToEnd());
}
AmazonCloudWatchLogsClient client = new AmazonCloudWatchLogsClient();
Thread.Sleep(40000);
}
catch (Exception ex)
{
Console.WriteLine(ex?.Message);
Console.WriteLine(ex?.InnerException?.Message);
}
Console.ReadLine();
}
}
}
//Console.WriteLine("My Test 3 ");
// string createText = "" + Environment.NewLine;
//AmazonCloudWatchLogsClient logClient = new AmazonCloudWatchLogsClient(RegionEndpoint.USEast1);
//var logGroups = logClient.DescribeLogGroups();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment