Skip to content

Instantly share code, notes, and snippets.

@tbaums
Created March 28, 2021 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbaums/efc7bd2539a86e7f0bc1e4bdde2e6a54 to your computer and use it in GitHub Desktop.
Save tbaums/efc7bd2539a86e7f0bc1e4bdde2e6a54 to your computer and use it in GitHub Desktop.
alias l="ls -alh"
alias k="kubectl"
mkdir /root/.ssh
aws s3 cp s3://mtanenbaum-rok-tools/ ./ --recursive
ssh-keyscan github.com >> github_key
ssh-keygen -lf github_key
cat github_key >> /root/.ssh/known_hosts
rm github_key
mv id_rsa /root/.ssh
chmod 400 /root/.ssh/id_rsa
ssh -T git@github.com
git config --global user.name "mtanenbaum"
git config --global user.email mtanenbaum@arrikto.com
mv dockerconfig.json /root
export AWS_ACCOUNT=409688176173
export AWS_IAM_USER=mtanenbaum
export AWS_DEFAULT_REGION=us-east-1
export VPCID=$(aws ec2 describe-vpcs --filters Name=isDefault,Values=true | jq -r '.Vpcs[0].VpcId') && echo ${VPCID?}
export SUBNETIDS=$(aws ec2 describe-subnets --filters Name=vpc-id,Values=${VPCID?} | jq -r '.Subnets[].SubnetId' | xargs) && echo ${SUBNETIDS}
export SECURITYGROUP=max-permissions-eks-clusters
export CIDR=0.0.0.0/0
export CIDRS=$CIDR
export CLUSTERNAME=$AWS_ACCOUNT-$AWS_IAM_USER-cluster
export ACCOUNT_ID=409688176173
export SECURITYGROUPID=sg-0fbd1a0dc17419777
export SECURITYGROUPIDS=$(aws ec2 describe-security-groups --filters Name=vpc-id,Values=${VPCID?} Name=group-name,Values=${SECURITYGROUP?},default | jq -r '.SecurityGroups[].GroupId' | xargs)
aws eks create-cluster \
--name ${CLUSTERNAME?} \
--role-arn arn:aws:iam::${ACCOUNT_ID?}:role/eksServiceRole \
--resources-vpc-config subnetIds=${SUBNETIDS// /,},securityGroupIds=${SECURITYGROUPIDS// /,},endpointPublicAccess=true,endpointPrivateAccess=true,publicAccessCidrs=${CIDRS// /,} \
--tags owner=${AWS_ACCOUNT?}/${AWS_IAM_USER?} \
--kubernetes-version 1.17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment