Posts by SpinningOps Editor

What are Chrome DevTools

When you want to debug a web application or website and if you’re using Chrome you can do it via Chrome DevTools other browsers have similar tools as well.

so what are the common DevTools?

  • Console – main usage is to log messages and run JavaScript.
  • Network – inspect network activity.
  • Storage – view, edit, and delete a page’s HTTP cookies.
  • Performance – analyze runtime performance.
  • Security – check that a page is fully protected by HTTPS.

There are more DevTools available check them out at this link

What is Disposable Resources

Disposable Resources are A compute unit that is meant to be destroyed.

Meaning we don’t troubleshoot or configure the server on runtime, if the compute unit gets an error we don’t fix it we spawn a new one.

Why should you adopt Disposable Resources in your compute cloud?

First, let’s compare Long-Running Servers vs. Disposable Resources. when you have a long-running server you need to make sure that the server is always working (no downtime), you need to configure it and make sure the services are active and on and on.

With Disposable Resources, you keep an image that is pre-configured, tested and have the exact dependencies and services that you defined when you created that image hence getting the same result on different environment and clouds, also once you need to deploy a new version just make a new image.

Now that we have an image of our ”server” we can deploy it with no surprises and no troubleshooting is needed because that image is immutable.

How to send rsyslog to S3 using Fluentd

When you have a server you want to get metric, logs and data to measure the server performance, in this blog post we’ll send rsyslog to S3 and we’ll use fluentd.

Create IAM user

You’ll need a IAM user to send data to S3 so that user will need permissions to do so.

create the new user and use it only for this purpose so you can manage your server, S3, IAM for this project.

Create S3 bucket policy with full permissions ONLY to the specific bucket that is intended for the data/logs.

Install Ruby and awscli

apt-get install ruby-full

install development tools

apt-get install build-essential

install awscli

apt-get install python3-pip
pip3 install awscli

Install fluentd

gem install fluentd

create the configuration file

fluentd --setup /etc/fluent

edit conf file (sample file here)

vi /etc/fluent/fluent.conf

Send log messages to Fluentd

edit

vi /etc/rsyslog.conf

add

*.* @spinningops.com:5140

restart rsyslog

systemctl start rsyslog

check status

systemctl status rsyslog

Start fluentd

fluentd -c fluentd.conf

for the full install please check this GitHub LINK

How to install Prometheus and Grafana

If you don’t monitor you can’t know the problem or measure metrics, in this post we’ll install prometheus to monitor a server and grafana to create a dashboard.

Infra required

create 3 servers:
monitor-server, this server will be used as premetheus.
monitor-target, this server will be Linux machine we will monitor.
monitor-dashboard, this server is grafana.

Install Prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.25.0/prometheus-2.25.0.linux-amd64.tar.gz

Extract files

tar xvfz prometheus-*.tar.gz
cd prometheus-*

Start the prometheus server to verify installation

./prometheus

Install Node Explorer

get https://github.com/prometheus/node_exporter/releases/download/v1.1.1/node_exporter-1.1.1.linux-amd64.tar.gz

Extract files

tar xvfz node_exporter-*.*-amd64.tar.gz
cd node_exporter-*.*-amd64

Run Node Exporter to start collecting metrics

 ./node_exporter

Install Grafana

apt-get install -y adduser libfontconfig1wget https://dl.grafana.com/oss/release/grafana_7.4.2_amd64.deb
apt install ./grafana_7.4.2_amd64.deb

Configuration file location

 /etc/grafana/grafana.ini

Start Grafana server

systemctl start grafana-server
systemctl status grafana-server

If you want the full detailed instructions its at this LINK

How to browse websites using Linux cli terminal

Sometimes you miss the days of just a shell and a terminal cli to avoid the noise and get the info you need without distractions, in my opinion people don’t even think of that and go straight to their favorite browser. next time try something else, something like browsing from Linux terminal using cli.

How to browse websites using cli?

this blog post is for Linux users, if you’re interested in other operating systems send me an email requesting a blog post with your favorite OS and I’ll try to make one for you.

start by installing w3m

sudo apt install w3m

then browse the website

w3m spinningops.com

let’s try another website

w3m www.reddit.com/r/wallstreetbets

use keyboard arrows to navigate throw the website, use Enter key to click a link and use Q key to exit the cli browser

How to list your EC2 instances across all regions

Tracking your EC2 instances can be overlooked especially when you have large amount of instances running.

so how do you know how many are currently active and on what regions?

it’s better to run your infra as groups or clusters so you’ll know your company stack is efficiency and optimized, using only what you need.

but if you did start single instances you’ll probably need to keep track on those instances for security and costs reasons.

Start the list_ec2_instances.sh to check how many instances are active across all regions.

also you can use list_ec2_instance_and_region.py to list regions, list instances ID’s and delete instances straight from your laptop’s bash shell.

How to start Minecraft server at AWS

How do you play Minecraft? where do you host your gaming servers? in this blog post we’ll use AWS to play Minecraft.

How to install Minecraft at AWS?

1. you’ll need to start an instance and install docker
2. then create AMI from that instance
3. update the AMI in the instance ID in the script
4. change the instance type per your load / number of players
5. create a security group with the IP’s of the players
6. create pem file
7. add the security group and key file to the create_instance_minecraft function

Once your AMI is ready run the script:

launch_minecraft_instance.py

Is the game playable using a remote server?

When I tested Minecraft at AWS I got less than 70ms and the game run smoothly without any issues.

How do you save the game?

You’ll need to add persistent data to save your game, use EBS volume.

How to get current billing amount AWS

As a cloud administrator you’re responsible for cloud billing as well as infrastructure.

Do you monitor your current billing amount?

So how do you get the current AWS billing in a few lines of code?

run the ce.py script to find out the current amount.

How to list CloudFront distribution

How do you manage your CloudFront distribution? if you have one it’s easy but what if you have many CF distributions?

Listing CF distributions can help organize and operate your CDN.

How to list CloudFront distributions with a few lines of code?

Run the get_cloudfont_id entering your domain name to filter your CF distribution, once the output of the distribution ID is displayed you can use it to manage your CloudFront distributions.