public static void Main(string[] args) { Console.WriteLine("A simple standalone C# DynamoDB test. Needs two environmental variables set:"); Console.WriteLine("* 'AWS_ACCESS_KEY_ID'"); Console.WriteLine("* 'AWS_SECRET_ACCESS_KEY'"); if (args.Length < 1) { Console.WriteLine(""); Console.WriteLine("Usage: `StandaloneDynamoDB <command> [table_name]`, where `command` is one of:"); Console.WriteLine("* `create` : Create the table."); Console.WriteLine("* `delete` : Delete the table."); Console.WriteLine("* `recreate` : Delete the table and immediately create it again."); Console.WriteLine("* `fill` : Add [1 .. 5] to the table."); Console.WriteLine("* `scan` : Show table contents."); Console.WriteLine("* `publish` : Read strings from the terminal and keep publishing them."); Console.WriteLine("* `subscribe` : Scan the table continuously."); Console.WriteLine("And `table_name` defaults to '{0}'.", DefaultTableName); } Console.WriteLine(""); var command = (args.Length >= 1 ? args[0].ToLower() : ""); while (command == "") { Console.Write("As you didn't provide a command from command line, enter it now: "); command = Console.ReadLine().ToLower(); } var table_name = args.Length >= 2 ? args[1] : DefaultTableName; try { var runner = new DynamoDB(table_name); switch (command) { case "create": runner.CommandCreate(); break; case "delete": runner.CommandDelete(); break; case "recreate": runner.CommandDelete(); runner.CommandCreate(); break; case "fill": runner.CommandFill(); break; case "scan": runner.CommandScan(); break; case "publish": runner.CommandPublish(); break; case "subscribe": runner.CommandSubscribe(); break; default: Console.WriteLine("Unrecognized command."); break; } } catch (Exception e) { // Most likely, the required environmental variables are not set. Console.WriteLine("Exception: {0}", e); } }