• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for October 2021

Install AdoptOpenJDK

October 28, 2021

OpenJDK is an open-source implementation of the Java.

How to install AdoptOpenJDK.

TAR

cd /usr/java
wget --no-check-certificate https://bit.ly/3jKm3KZ
tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz
export PATH=$PWD/jdk8u312-b07/bin:$PATH
java -version

cd /usr/java wget --no-check-certificate https://bit.ly/3jKm3KZ tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u312b07.tar.gz export PATH=$PWD/jdk8u312-b07/bin:$PATH java -version

RPM

cat <<'EOF' > /etc/yum.repos.d/adoptopenjdk.repo
[AdoptOpenJDK]
name=AdoptOpenJDK
baseurl=http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
EOF

cat <<'EOF' > /etc/yum.repos.d/adoptopenjdk.repo [AdoptOpenJDK] name=AdoptOpenJDK baseurl=http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/$releasever/$basearch enabled=1 gpgcheck=1 gpgkey=https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public EOF

yum install adoptopenjdk-8-openj9

yum install adoptopenjdk-8-openj9

Filed Under: Linux Tagged With: adoptopenjdk, install, java

Terraform User Data

October 26, 2021

Here’s how to add userdata in Terraform.

user_data = filebase64("${path.module}/example.sh")

user_data = filebase64("${path.module}/example.sh")

Filed Under: Cloud Tagged With: bootstrap, ec2, script, terraform, userdata

AWS CloudWatch Alarms

October 25, 2021

How to enable and disable CloudWatch alarms

$ aws cloudwatch disable-alarm-actions --alarm-names myalarm --region us-east-1
$ aws cloudwatch enable-alarm-actions --alarm-names myalarm --region us-east-1

$ aws cloudwatch disable-alarm-actions --alarm-names myalarm --region us-east-1 $ aws cloudwatch enable-alarm-actions --alarm-names myalarm --region us-east-1

Filed Under: Cloud Tagged With: alarm, aws, cloudwatch, disable, enable

Run Telnet on Git Bash

October 20, 2021

Although telnet is not used regularly since insecure, it’s a handy tool for testing ports.

For example, to check if a port 80 is open, you run this command.

$ telnet servername 80

$ telnet servername 80

Git Bash does not come with telnet, but you can use the Windows version by using winpty.

$ winpty telnet servername 457
Connecting To servername...Could not open connection to the host, on port 457: Connect failed

$ winpty telnet servername 457 Connecting To servername...Could not open connection to the host, on port 457: Connect failed

If port is open, you get an empty reply, just like in Windows.

Filed Under: Linux Tagged With: check, git bash, ports, telnet, windows

AWS Suspend Auto Scaling Group

October 20, 2021

You can administratively suspend a process in AWS Auto Scaling group for troubleshooting purposes.

Here are the available processes.

Terminate
Launch
AddToLoadBalancer
AlarmNotification
AZRebalance
HealthCheck
ReplaceUnhealthy
ScheduledActions

Terminate Launch AddToLoadBalancer AlarmNotification AZRebalance HealthCheck ReplaceUnhealthy ScheduledActions

If you have difficulty launching a VM, check if any of these processes are suspended.

Removed them if applicable.

Filed Under: Cloud Tagged With: auto scaling, aws, maintenance, processes, suspend

Check Certificate Expiration

October 20, 2021

Here’s the openssl command to find out if a cert is expired.

$ openssl s_client -connect yourdomain.com:443 -servername yourdomain.com 2> /dev/null | openssl x509 -noout -dates

$ openssl s_client -connect yourdomain.com:443 -servername yourdomain.com 2> /dev/null | openssl x509 -noout -dates

Result

notBefore=Apr  9 00:00:00 2020 GMT
notAfter=Apr  9 23:59:59 2022 GMT

notBefore=Apr 9 00:00:00 2020 GMT notAfter=Apr 9 23:59:59 2022 GMT

Filed Under: Linux Tagged With: certificate, expiration, openssl, ssl

Copy S3 to GCS

October 13, 2021

You can use gsutil to copy directly from a S3 bucket to a GCS bucket.

gsutil can read/write to a S3 bucket as long as it has access to your AWS credentials.

The -R option is recursive and -m is for multi-threaded or multi-processing.

gsutil -m cp -R s3://bucket/ gs://bucket

gsutil -m cp -R s3://bucket/ gs://bucket

You can also use rsync instead of cp. Just be aware that rsync does not copy empty directory trees

gsutil -m rsync -r s3://bucket/ gs://bucket

gsutil -m rsync -r s3://bucket/ gs://bucket

If you plan to use -d, Use it with caution since it deletes content.

You may have to set the following to your defaults accounts.

export AWS_PROFILE=yourprofile
gcloud config set project your-project-id

export AWS_PROFILE=yourprofile gcloud config set project your-project-id

This ensures that default profile and projects are used in both AWS and GCP.

Filed Under: Cloud Tagged With: aws, cp, gcp, gcs, multi-processing, multi-threaded, rsync, s3

Git Undo Add

October 13, 2021

To undo a git add, run git reset file or get reset.

git reset filename
git reset

git reset filename git reset

Run git status to check.

git status

git status

Filed Under: Linux Tagged With: add, git, reset, undo

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023