This application uses Pulumi to manage AWS cloud infrastructure.
- Backend:
- DynamoDB
- APIGateway
- Lambda
- Frontend:
- HTML
- CSS
- @pulumi/aws
- @pulumi/awsx
- Data Storage for the visitor count
id | count |
---|---|
count | 19 |
let countTable = new aws.dynamodb.Table("countTable", {
attributes: [{ name: "id", type: "S" }],
hashKey: "id",
readCapacity: 5,
writeCapacity: 5,
});
- REST api - handles request/response
let endpoint = new awsx.apigateway.API("endpoint", {
routes: [{
path: "",
method: "GET",
...
- Event driven
- Allows me to run code when needed
eventHandler: async (event) => {
// CREATE client for DynamoDB
let client = new aws.sdk.DynamoDB.DocumentClient();
// GET current count data
let countData = await client.get({
TableName: countTable.name.get(),
Key: { id: "count" },
ConsistentRead: true,
}).promise();
...