public Handler() { ISession session = SessionStandalone .Init() .WithSessionOptions(AwsAccessKeyId, AwsAccessKey, AwsSessionToken, RegionName) .WithConfig(LocalStackHost) .Create(); _awsS3Client = session.CreateClient <AmazonS3Client>(); _awsDynamoDbClient = session.CreateClient <AmazonDynamoDBClient>(); }
private static async Task Main(string[] args) { var awsAccessKeyId = "Key Id"; var awsAccessKey = "Secret Key"; var awsSessionToken = "Token"; var regionName = "us-west-1"; var localStackHost = "localhost"; ISession session = SessionStandalone.Init().WithSessionOptions(awsAccessKeyId, awsAccessKey, awsSessionToken, regionName).WithConfig(localStackHost).Create(); var amazonS3Client = session.CreateClient <AmazonS3Client>(); const string bucketName = "test-bucket-3"; const string filePath = "SampleData.txt"; const string key = "SampleData.txt"; await CreateBucketAndUploadFileAsync(amazonS3Client, bucketName, filePath, key); }
private static async Task Main() { /* * ==== Default Values ==== * AwsAccessKeyId: accessKey (It doesn't matter to LocalStack) * AwsAccessKey: secretKey (It doesn't matter to LocalStack) * AwsSessionToken: token (It doesn't matter to LocalStack) * RegionName: us-east-1 * ==== Custom Values ==== * var sessionOptions = new SessionOptions("someAwsAccessKeyId", "someAwsAccessKey", "someAwsSessionToken", "eu-central-"); */ var sessionOptions = new SessionOptions(); /* * ==== Default Values ==== * LocalStackHost: localhost * UseSsl: false * UseLegacyPorts: false (Set true if your LocalStack version is 0.11.4 or below) * EdgePort: 4566 (It doesn't matter if use legacy ports) * ==== Custom Values ==== * var configOptions = new ConfigOptions("mylocalhost", false, false, 4566); */ var configOptions = new ConfigOptions(); ISession session = SessionStandalone.Init() .WithSessionOptions(sessionOptions) .WithConfigurationOptions(configOptions).Create(); var amazonS3Client = session.CreateClientByImplementation <AmazonS3Client>(); const string bucketName = "test-bucket-3"; const string filePath = "SampleData.txt"; const string key = "SampleData.txt"; Console.WriteLine("Press any key to start Sandbox application"); Console.ReadLine(); await CreateBucketAndUploadFileAsync(amazonS3Client, bucketName, filePath, key); }
static ClientCreationTests() { Session = SessionStandalone.Init().Create(); }
static CreateClientByInterfaceTests() { Session = SessionStandalone.Init().Create(); }
static CreateClientByImplementationTests() { Session = SessionStandalone.Init().Create(); }