• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for April 2019

XFS vs Ext4 Commands

April 30, 2019

File system command differences between ext3 and xfs.

Taskext4xfs
Creating a file systemmkfs.ext4mkfs.xfs
Mounting a file systemmountmount
Resizing a file systemresize2fsxfs_growfs
Repairing a file systeme2fsckxfs_repair
Changing the label on a file systeme2labelxfs_admin -L
Reporting on disk space and file usagequota quota
Debugging a file systemdebugfsxfs_db
Saving critical file system metadata to a filee2imagexfs_metadump

Filed Under: Linux Tagged With: ext4, file system, xfs

Online RTMP Players

April 20, 2019

Here are several online RTMP players:

  • Wowza Flash Player
  • Wowza Test Player
  • HLSTester
  • HLSPlayer

I prefer the Wowza test players. The last two has annoying ads.

Filed Under: Cloud, Linux Tagged With: flash, online, player, rtmp, wowza

Encrypt Volume via Terraform

April 9, 2019

Here’s the Terraform script to encrypt an unencrypted volume. It creates a snapshot, encrypts a snapshot, and encrypts the volume.

#
# Set Variables
#
variable "volume" {
  description = "The Volume to encrypt: vol-12345678901234567"
}
variable "region" {
  description = "The Region: us-east-2"
}
variable "az" {
  description = "The AZ: us-east-2a"
}
 
#
# Set Credentials
#
provider "aws" {
	access_key = "put-your-access-key-here"
	secret_key = "put-your-secret-key-here"
	region = "${var.region}"
}
 
/*
#
# Create Unencrypted Volume
#
resource "aws_ebs_volume" "unencrypted_volume" {
  availability_zone = "${var.az}"
  size              = 10
  tags = {
    Name = "Unencrypted_Volume"
  }
}
*/
 
#
# Create Unencrypted Snapshot
#
resource "aws_ebs_snapshot" "unencrypted_snapshot" {
  #volume_id = "${aws_ebs_volume.unencrypted_volume.id}"
  volume_id = "${var.volume}"
  tags = {
    Name = "Unencrypted_Snapshot"
  }
}
 
#
# Create Encrypted Snapshot
#
resource "aws_ebs_snapshot_copy" "encrypted_snapshot" {
  source_snapshot_id = "${aws_ebs_snapshot.unencrypted_snapshot.id}"
  source_region      = "${var.region}"
  encrypted = true
  tags = {
    Name = "Encrypted_Snapshot"
  }
}
 
#
# Created Encrypted Volume
#
resource "aws_ebs_volume" "encrypted_volume" {
  availability_zone = "${var.az}"
  snapshot_id = "${aws_ebs_snapshot_copy.encrypted_snapshot.id}"
  tags = {
    Name = "Encrypted_Volume"
  }
}

# # Set Variables # variable "volume" { description = "The Volume to encrypt: vol-12345678901234567" } variable "region" { description = "The Region: us-east-2" } variable "az" { description = "The AZ: us-east-2a" } # # Set Credentials # provider "aws" { access_key = "put-your-access-key-here" secret_key = "put-your-secret-key-here" region = "${var.region}" } /* # # Create Unencrypted Volume # resource "aws_ebs_volume" "unencrypted_volume" { availability_zone = "${var.az}" size = 10 tags = { Name = "Unencrypted_Volume" } } */ # # Create Unencrypted Snapshot # resource "aws_ebs_snapshot" "unencrypted_snapshot" { #volume_id = "${aws_ebs_volume.unencrypted_volume.id}" volume_id = "${var.volume}" tags = { Name = "Unencrypted_Snapshot" } } # # Create Encrypted Snapshot # resource "aws_ebs_snapshot_copy" "encrypted_snapshot" { source_snapshot_id = "${aws_ebs_snapshot.unencrypted_snapshot.id}" source_region = "${var.region}" encrypted = true tags = { Name = "Encrypted_Snapshot" } } # # Created Encrypted Volume # resource "aws_ebs_volume" "encrypted_volume" { availability_zone = "${var.az}" snapshot_id = "${aws_ebs_snapshot_copy.encrypted_snapshot.id}" tags = { Name = "Encrypted_Volume" } }

Filed Under: Linux Tagged With: encrypt, snapshot, terraform, volume

Terraform Installation

April 9, 2019

Where did I install Terraform?

cd /usr/local/bin/
terraform --version

cd /usr/local/bin/ terraform --version

Filed Under: Linux Tagged With: installed, location, terraform

Sudoers Directory

April 8, 2019

What’s in the /etc/sudoers.d/ directory? It’s a group of files with the following format as displayed in the code below. In the example, the file allows a Linux group or an AD group to assume the role of root, via the sudo command. As long as the group uses the correct format, and is located inside the /etc/sudoers.d/ directory, that group will have access to root.

%groupname  ALL=(ALL)   NOPASSWD: ALL

%groupname ALL=(ALL) NOPASSWD: ALL

Filed Under: Linux Tagged With: sudo, sudoers

Convert PFX to PEM format

April 3, 2019

SSL certificates comes in multiple formats. Some providers will hand you over certificates in PFX format which comes in a single file. If you need to import it to AWS Certificate Manager, you will need to convert it from PFX to PEM format. The following set of commands uses OpenSSL and pkcs12 to convert a SSL certificate from PFX to PEM format.

openssl pkcs12 -in cert.pfx -nocerts -out key.pem
openssl rsa -in key.pem -out server.key
openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.pem
openssl pkcs12 -in cert.pfx -nodes -nokeys -out chain.pem

openssl pkcs12 -in cert.pfx -nocerts -out key.pem openssl rsa -in key.pem -out server.key openssl pkcs12 -in cert.pfx -clcerts -nokeys -out cert.pem openssl pkcs12 -in cert.pfx -nodes -nokeys -out chain.pem

It result in 3 files.

  • server.key is the private key
  • cert.pem is the certificate
  • cert.pem and chain.pem are the full chain.

Once you have them, you can the proceed to import it to ACM.

SSL Certificate Import

Filed Under: Linux Tagged With: certificate, convert, pem, pfx, ssl

Who’s Logged in?

April 3, 2019

Find out who is logged in to the system.

$ w
$ who

$ w $ who

Filed Under: Linux Tagged With: logged in, who

Find the Biggest File

April 1, 2019

Find the biggest files in the current directory. Sort by from large to small. Display only the top 20. Display in human readable format.

find -type f -exec du -Sh {} + | sort -rh | head -n 20

find -type f -exec du -Sh {} + | sort -rh | head -n 20

Filed Under: Linux Tagged With: big, du, file, find, sort

  • Home
  • About
  • Archives

Copyright © 2023