Skip to content

Instantly share code, notes, and snippets.

View pahud's full-sized avatar
🏠
Working from home

Pahud Hsieh pahud

🏠
Working from home
View GitHub Profile
@pahud
pahud / main.workflow
Last active July 24, 2023 08:20
Github Actions with Amazon EKS CI/CD
workflow "Demo workflow" {
on = "push"
resolves = ["SNS Notification"]
}
action "Build Image" {
uses = "actions/docker/cli@c08a5fc9e0286844156fefff2c141072048141f6"
runs = ["/bin/sh", "-c", "docker build -t $IMAGE_URI ."]
env = {
IMAGE_URI = "xxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/github-action-demo:latest"
@pahud
pahud / regions.txt
Created January 19, 2019 07:47
all aws region codes
ap-south-1
eu-west-3
eu-north-1
eu-west-2
eu-west-1
ap-northeast-3
ap-northeast-2
ap-northeast-1
sa-east-1
ca-central-1
@pahud
pahud / demo.sh
Created January 15, 2019 02:06
kubectl cheatsheet
# get nginx 1st pod IP
kubectl get po -l run=nginx --output=jsonpath={.items[0].status.podIP}
@pahud
pahud / lftp-via-sftp-to-s3.sh
Created January 2, 2019 07:25
mirror your local dir to S3 via sftp with lftp
#!/bin/bash
open_lftp(){
lftp sftp://pahud:@s-xxxxxxxxxxxxxx.server.transfer.eu-central-1.amazonaws.com "$@"
}
backup_canon1(){
open_lftp -e "ls; cd EOS_DIGITAL/DCIM/100CANON/; mirror -R --only-newer --ignore-time /Volumes/2T-BLACK/Norway2018/Canon_M50/backup01/ .;exit;"
}
@pahud
pahud / create-asg.sh
Created November 16, 2018 03:49
Create Autoscaling Group with more instance types and purchase options
#!/bin/bash
# make sure your awscli version is >= 1.16.56
#
# 1. create a launch template and copy the LaunchTemplateId
# 2. create mix-policy.json
# 3. run create-asg.sh
#
# by pahudnet@gmail.com
asgname=demo
@pahud
pahud / upgrade-awscli.sh
Last active September 22, 2018 14:32
upgrade AWS CLI
#!/bin/bash
cleanup() {
rm -rf awscli-bundle
rm -f awscli-bundle.zip
}
cleanup
rm -rf awscli-bundle*
@pahud
pahud / resize.md
Last active November 13, 2020 04:23
resize Cloud9 root volume size
  • resize the EBS volume size from EC2 console(e.g. 8GB to 20GB)
  • sudo growpart /dev/xvda 1
  • sudo resize2fs /dev/xvda1 or sudo resize2fs /dev/nvme0n1p1
@pahud
pahud / ec2Fleet.json
Created July 27, 2018 03:14
EC2 Fleet CLI sample
{
"LaunchTemplateConfigs": [
{
"LaunchTemplateSpecification": {
"LaunchTemplateId": "lt-0f0f4ab2e775e73a2",
"Version": "1"
},
"Overrides": [
{
"InstanceType": "t2.medium",
@pahud
pahud / create_cluster_localmirror.sh
Created July 24, 2018 04:16
pahud/kops-bjs Kops 1.9.2(K8s 1.9.8)
#!/bin/bash
source env.config
cluster_name='cluster.zhy.k8s.local'
# official CoreOS AMI
#ami='ami-e7958185'
ami='ami-06a0b464'
@pahud
pahud / helm-sa-rolebinding.yaml
Last active July 17, 2018 14:31
Helm for Amazon EKS
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: v1
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata: