Infrastructure

Code Infrastructure improvements

To add:

  • DataDog AWS monitoring machines with DataDog

❌ DataDog integrations: https://app.datadoghq.com/integrations/amazon-web-services?cfpending=1&tab=aws-integrations

  • ❌ To add confirm that the availability zones

Confirm that the availability zones (us-east-2a, us-east-2b in my case) specified in my script are valid for my AWS account.

// confirm availability zones

stef@devops/~/D/D/code> aws ec2 describe-availability-zones
{
    "AvailabilityZones": [
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "us-east-2",
            "ZoneName": "us-east-2a",
            "ZoneId": "use2-az1",
            "GroupName": "us-east-2",
            "NetworkBorderGroup": "us-east-2",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "us-east-2",
            "ZoneName": "us-east-2b",
            "ZoneId": "use2-az2",
            "GroupName": "us-east-2",
            "NetworkBorderGroup": "us-east-2",
            "ZoneType": "availability-zone"
        },
        {
            "State": "available",
            "OptInStatus": "opt-in-not-required",
            "Messages": [],
            "RegionName": "us-east-2",
            "ZoneName": "us-east-2c",
            "ZoneId": "use2-az3",
            "GroupName": "us-east-2",
            "NetworkBorderGroup": "us-east-2",
            "ZoneType": "availability-zone"
        }
    ]
}

❌ Pass through a YAML validator API ( like https://codebeautify.org/yaml-validator/ )

❌ Add Elastic IP address https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html?icmpid=docs_ec2_console

❌ Experiment with Designer: https://us-east-2.console.aws.amazon.com/cloudformation/designer/home?region=us-east-2#

❌ For a production environment, need to narrow down the security rules to only allow the necessary traffic. ( yaml ).

❌ Run node.js server:

const http = require('http');
const fs = require('fs');
const path = require('path');

const server = http.createServer((req, res) => {
  // Determine the file path based on the request URL

  const filePath = path.join(__dirname, req.url === '/' ? 'index.html' : req.url);
  
  // Read the file
  fs.readFile(filePath, (err, content) => {
    if (err) {
      // If the file doesn't exist, return a 404 response
      res.writeHead(404);
      res.end('File not found!');
    } else {
      // Set the content type based on the file extension
      const ext = path.extname(filePath);
      let contentType = 'text/html';
      if (ext === '.js') {
        contentType = 'text/javascript';
      } else if (ext === '.css') {
        contentType = 'text/css';
      }
      
      // Set the response headers
      res.writeHead(200, { 'Content-Type': contentType });
      
      // Send the file content
      res.end(content, 'utf-8');
    }
  });
});

// Start the server
server.listen(8080, () => {
  console.log('Server is running on http://localhost:8080');
});

//run cli with: `/usr/lib/code-server/code-server --bind-addr 0.0.0.0:8080 --auth none`
// will run node server on 8080 and send the requests to the tunnel

Run with: $ /usr/lib/code-server/code-server --bind-addr 0.0.0.0:8080 --auth none

This will run a node server and expose localhost to 8080 where will will route requests to a tunnel that will point to public hostname: aws.stefanogramm.com

❌New Relic: https://one.newrelic.com

Last updated

Was this helpful?