filmov
tv
AWS: Frontend web application with Javascript, DynamoDB and Amazon Cognito

Показать описание
This tutorial will explain how to create a serverless and backendless javascript frontend application using DynamoDB and Cognito.
User ► HTML/JS ► Cognito / DynamoDB
Reference of my previous video for more information on AWS using a backend service and API gateway and hosting static HTML files:
My first video where I explain how to configure AWS:
AWS Javascript API files:
Javascript Examples for DynamoDB:
-----
Javascript:
var idToken = null;
function checkLogin() {
var url = new URL(url_string);
if (idToken != null) {
auth();
}
}
function auth() {
region: "us-east-2",
// accessKeyId: "(ACCESS_KEY_ID)",
// secretAccessKey: "(SECRET_ACCESS_KEY)"
});
IdentityPoolId : '(IDENTITY POOL ID)',
Logins : {
}
});
}
function insertItem() {
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName :"Person",
Item:{
"FirstName": "John", // Partition Key
"LastName": "Smith", // Sort Key
"info": {
"FavoriteColor": "blue",
"YearOfBirth": 1942
}
}
};
if (err) {
} else {
}
});
}
function readItem() {
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName: "Person",
Key:{
"FirstName": "John",// Partition Key
"LastName": "Smith" // Sort/Range Key
}
};
if (err) {
} else {
}
});
}
-----
Javascript if you want to login internally inside your page.
function signInButton() {
var authenticationData = {
};
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
var poolData = {
UserPoolId : "(POOL_ID)", // Your user pool id here
ClientId : "(APP_CLIENT_ID)", // Your client id here
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var userData = {
Pool : userPool,
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
onSuccess: function (result) {
},
onFailure: function(err) {
},
});
}
-- Contents of this video --
0:00 Intro
1:52 Configure Cognito
7:40 Create DynamoDB table
8:20 Create IAM role and permission
10:52 More Cognito configuration
16:02 Javascript and HTML code
22:41 Tests and final comments
User ► HTML/JS ► Cognito / DynamoDB
Reference of my previous video for more information on AWS using a backend service and API gateway and hosting static HTML files:
My first video where I explain how to configure AWS:
AWS Javascript API files:
Javascript Examples for DynamoDB:
-----
Javascript:
var idToken = null;
function checkLogin() {
var url = new URL(url_string);
if (idToken != null) {
auth();
}
}
function auth() {
region: "us-east-2",
// accessKeyId: "(ACCESS_KEY_ID)",
// secretAccessKey: "(SECRET_ACCESS_KEY)"
});
IdentityPoolId : '(IDENTITY POOL ID)',
Logins : {
}
});
}
function insertItem() {
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName :"Person",
Item:{
"FirstName": "John", // Partition Key
"LastName": "Smith", // Sort Key
"info": {
"FavoriteColor": "blue",
"YearOfBirth": 1942
}
}
};
if (err) {
} else {
}
});
}
function readItem() {
var docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName: "Person",
Key:{
"FirstName": "John",// Partition Key
"LastName": "Smith" // Sort/Range Key
}
};
if (err) {
} else {
}
});
}
-----
Javascript if you want to login internally inside your page.
function signInButton() {
var authenticationData = {
};
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
var poolData = {
UserPoolId : "(POOL_ID)", // Your user pool id here
ClientId : "(APP_CLIENT_ID)", // Your client id here
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var userData = {
Pool : userPool,
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
onSuccess: function (result) {
},
onFailure: function(err) {
},
});
}
-- Contents of this video --
0:00 Intro
1:52 Configure Cognito
7:40 Create DynamoDB table
8:20 Create IAM role and permission
10:52 More Cognito configuration
16:02 Javascript and HTML code
22:41 Tests and final comments
Комментарии