Skip to content

Quick project to practice Infrastructure as Code, I used Pulumi to manage AWS cloud services.

Notifications You must be signed in to change notification settings

jessicaUP/CloudVisitCount

Repository files navigation

VISITOR COUNTER

Live Link

SUMMARY

This application uses Pulumi to manage AWS cloud infrastructure.

AWS SERVICES:

  • Backend:
    • DynamoDB
    • APIGateway
    • Lambda
  • Frontend:
    • HTML
    • CSS

PULUMI LIBRARIES:

  • @pulumi/aws
  • @pulumi/awsx

DYNAMODB

  • 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,
});

API GATEWAY

  • REST api - handles request/response
let endpoint = new awsx.apigateway.API("endpoint", {
  routes: [{
    path: "",
    method: "GET",
    ...

LAMBDA

  • 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();
      ...

About

Quick project to practice Infrastructure as Code, I used Pulumi to manage AWS cloud services.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published