AWS DynamoDB Testing

In this example below you will see how to do a AWS DynamoDB Testing with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by pthomison, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright pthomison ©
  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>AWS DynamoDB Testing</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <h2>AWS DynamoDB Testing</h2>
<Button id="but">Submit</Button>
<label>Key:</label>
<input type="text" name="key">
<label>Data:</label>
<input type="text" name="data">
  <script src='https://sdk.amazonaws.com/js/aws-sdk-2.6.10.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/pthomison/aws-dynamodb-testing-aBdmzK */
html {
  box-sizing: border-box;
}

*, *::after, *::before {
  box-sizing: inherit;
}

* {
  margin: 10px;
}

input {
  width: 400px !important;
}

/********
VARIABLES
********/
/************
GRID SETTINGS
*************/
/****************
FUNCTIONS/PRIVATE
*****************/
/***********************
FUNCTIONS/NEW-BREAKPOINT
************************/
/************
SETTINGS/GRID
*************/
/*******************
SETTINGS VISUAL GRID
********************/
/************************
SETTINGS DISABLE-WARNINGS
*************************/
/************
BOURBON NEAT
*************/
html {
  box-sizing: border-box;
}

*, *::after, *::before {
  box-sizing: inherit;
}

/******
BUTTONS
******/
button, input[type="button"], input[type="reset"], input[type="submit"] {
  appearance: none;
  background-color: #477dca;
  border: 0;
  border-radius: 3px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
  font-size: 1em;
  -webkit-font-smoothing: antialiased;
  font-weight: 600;
  line-height: 1;
  padding: 0.75em 1.5em;
  text-decoration: none;
  transition: background-color 150ms ease;
  user-select: none;
  vertical-align: middle;
  white-space: nowrap;
}
button:hover, button:focus, input[type="button"]:hover, input[type="button"]:focus, input[type="reset"]:hover, input[type="reset"]:focus, input[type="submit"]:hover, input[type="submit"]:focus {
  background-color: #3964a2;
  color: #fff;
}
button:disabled, input[type="button"]:disabled, input[type="reset"]:disabled, input[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
button:disabled:hover, input[type="button"]:disabled:hover, input[type="reset"]:disabled:hover, input[type="submit"]:disabled:hover {
  background-color: #477dca;
}

/****
FORMS
****/
fieldset {
  background-color: #f7f7f7;
  border: 1px solid #ddd;
  margin: 0 0 0.75em;
  padding: 1.5em;
}

input,
label,
select {
  display: block;
  font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
  font-size: 1em;
}

label {
  font-weight: 600;
  margin-bottom: 0.375em;
}
label.required::after {
  content: "*";
}
label abbr {
  display: none;
}

input[type="color"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"], input:not([type]), textarea,
select[multiple=multiple] {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
  font-size: 1em;
  margin-bottom: 0.75em;
  padding: 0.5em;
  transition: border-color 150ms ease;
  width: 100%;
}
input[type="color"]:hover, input[type="date"]:hover, input[type="datetime"]:hover, input[type="datetime-local"]:hover, input[type="email"]:hover, input[type="month"]:hover, input[type="number"]:hover, input[type="password"]:hover, input[type="search"]:hover, input[type="tel"]:hover, input[type="text"]:hover, input[type="time"]:hover, input[type="url"]:hover, input[type="week"]:hover, input:not([type]):hover, textarea:hover,
select[multiple=multiple]:hover {
  border-color: #b1b1b1;
}
input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="email"]:focus, input[type="month"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="time"]:focus, input[type="url"]:focus, input[type="week"]:focus, input:not([type]):focus, textarea:focus,
select[multiple=multiple]:focus {
  border-color: #477dca;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 5px rgba(55, 112, 192, 0.7);
  outline: none;
}
input[type="color"]:disabled, input[type="date"]:disabled, input[type="datetime"]:disabled, input[type="datetime-local"]:disabled, input[type="email"]:disabled, input[type="month"]:disabled, input[type="number"]:disabled, input[type="password"]:disabled, input[type="search"]:disabled, input[type="tel"]:disabled, input[type="text"]:disabled, input[type="time"]:disabled, input[type="url"]:disabled, input[type="week"]:disabled, input:not([type]):disabled, textarea:disabled,
select[multiple=multiple]:disabled {
  background-color: #f2f2f2;
  cursor: not-allowed;
}
input[type="color"]:disabled:hover, input[type="date"]:disabled:hover, input[type="datetime"]:disabled:hover, input[type="datetime-local"]:disabled:hover, input[type="email"]:disabled:hover, input[type="month"]:disabled:hover, input[type="number"]:disabled:hover, input[type="password"]:disabled:hover, input[type="search"]:disabled:hover, input[type="tel"]:disabled:hover, input[type="text"]:disabled:hover, input[type="time"]:disabled:hover, input[type="url"]:disabled:hover, input[type="week"]:disabled:hover, input:not([type]):disabled:hover, textarea:disabled:hover,
select[multiple=multiple]:disabled:hover {
  border: 1px solid #ddd;
}

textarea {
  resize: vertical;
}

input[type="search"] {
  appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
  display: inline;
  margin-right: 0.375em;
}
input[type="checkbox"] + label,
input[type="radio"] + label {
  display: inline-block;
}

input[type="file"] {
  margin-bottom: 0.75em;
  width: 100%;
}

select {
  margin-bottom: 1.5em;
  max-width: 100%;
  width: auto;
}

/*****
LISTS
*****/
ul,
ol {
  list-style-type: none;
  margin: 0 0 0 1em;
  padding: 0;
}

ol.default {
  list-style: decimal;
}

ul.default {
  list-style: disc;
}

dl {
  margin-bottom: 0.75em;
}
dl dt {
  font-weight: 600;
  margin-top: 0.75em;
}
dl dd {
  margin: 0 0 0 1em;
}

/******
TABLES
******/
table {
  border-collapse: collapse;
  margin: 0.75em 0;
  table-layout: fixed;
  width: 100%;
}

th {
  border-bottom: 1px solid #a6a6a6;
  font-weight: 600;
  padding: 0.75em 0;
  text-align: left;
}

td {
  border-bottom: 1px solid #ddd;
  padding: 0.75em 0;
}

tr,
td,
th {
  vertical-align: middle;
}

/**********
TYPOGRAPHY
**********/
body {
  color: #333;
  font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
  font-size: 1em;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
  font-size: 1em;
  line-height: 1.2;
  margin: 0 0 0.75em;
  font-weight: bold;
}

h1 {
  font-size: 2em;
}

h2 {
  font-size: 1.5em;
}

h3 {
  font-size: 1.3em;
}

h4 {
  font-size: 1.2em;
}

h5 {
  font-size: 1.1em;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: #477dca;
  text-decoration: none;
  transition: color 150ms ease;
}
a:active, a:focus, a:hover {
  color: #355e98;
}

hr {
  border-bottom: 1px solid #ddd;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  margin: 1.5em 0;
}

img,
picture {
  margin: 0;
  max-width: 100%;
}

em {
  font-style: italic;
}


/*Downloaded from https://www.codeseek.co/pthomison/aws-dynamodb-testing-aBdmzK */
// var roleARN = "arn:aws:iam::362159410824:user/testing_user";
// var clientARN = "amzn1.application-oa2-client.b8c2bca818374c0f90865a3d2cb78cdd";

AWS.config.update({ region: 'us-west-2c' });
var db = new AWS.DynamoDB({ apiVersion: '2012-08-10' });

db.listTables(function (err, data) {
  console.dir(data);
});

function submitData(key, data) {
  console.log("Submiting Data");
  console.log("Key: ", key);
  console.log("Data: ", data);
}

$("#but").on("click", function (e) {
  submitData();
});

Comments