Skip to content

Instantly share code, notes, and snippets.

@cloudfiles-me
cloudfiles-me / readme.md
Last active September 28, 2018 23:14
Install Helm on Amazon EKS
  • Install/upgrade Helm: brew install kubernetes-helm or brew upgrade kubernetes-helm

  • Install Tiller:

  • kubectl -n kube-system create sa tiller

  • Create new file rbac.yaml with this content

apiVersion: v1
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
@cloudfiles-me
cloudfiles-me / eksctl_create_cluster.md
Last active December 18, 2018 22:58
eksctl cluster creation
@cloudfiles-me
cloudfiles-me / readme.adoc
Created September 18, 2018 16:11 — forked from arun-gupta/readme.adoc
Kubernetes Cluster on AWS
  1. kops: https://github.com/kubernetes/kops

    1. Getting Started Guide: https://github.com/kubernetes/kops/blob/master/docs/aws.md

    2. Installing Kubernetes on AWS with kops: https://kubernetes.io/docs/getting-started-guides/kops/

    3. Mulit-master Kubernetes Cluster on AWS with kops: http://blog.arungupta.me/multimaster-kubernetes-cluster-amazon-kops/

    4. Booting Kubernetes on Amazon Elastic Compute with kops: https://deis.com/docs/workflow/quickstart/provider/aws/boot/

    5. Setting up an HA Kubernetes Cluster in AWS with private topology with kops 1.5.1: https://www.nivenly.com/kops-1-5-1/

    6. Kubernetes on AWS: https://daemonza.github.io/2017/01/15/kubernetes-on-aws/

    7. Your 2nd day with Kubernetes on AWS: https://www.nivenly.com/2nd-hour/

  2. Tectonic (Terraform): http://github.com/coreos/tectonic-installer

@cloudfiles-me
cloudfiles-me / kubectl_utils.txt
Last active March 9, 2021 17:37
Some useful kubectl commands
# Show name of pods with label app=nginx
kubectl get pod -l app=nginx -o json | jq '.items[] | .metadata.name'
kubectl get pod -l app=nginx -o json | jq '.items[] | .spec.containers[].resources'
# Show request/limit of memory and cpu for pods with label app=nginx
kubectl get pod -l app=nginx -o json | jq '.items[] | .spec.containers[].resources.requests.memory'
kubectl get pod -l app=nginx -o json | jq '.items[] | .spec.containers[].resources.limits.memory'
kubectl get pod -l app=nginx -o json | jq '.items[] | .spec.containers[].resources.requests.cpu'
kubectl get pod -l app=nginx -o json | jq '.items[] | .spec.containers[].resources.resources.limits.cpu'
@cloudfiles-me
cloudfiles-me / s3-bucket_policy_allow_ses_write.txt
Created September 4, 2018 18:23
S3 Bucket Policy to allow SES to write emails
{
"Version": "2012-10-17",
"Id": "GiveSESPermissionToWriteEmail",
"Statement": [
{
"Sid": "GiveSESPermissionToWriteEmail",
"Effect": "Allow",
"Principal": {
"Service": "ses.amazonaws.com"
},
@cloudfiles-me
cloudfiles-me / aws_lambda_python_environment_variables.py
Created August 24, 2018 19:47
Read environment variables in AWS Lambda using Python
import os
...
# if the key doesn't exist than raise a 'KeyError'
my_url = os.environ['my_variable_name']
# using get will return 'None' if a key is not present rather than raise a 'KeyError'
my_url = os.environ.get('KEY_THAT_MIGHT_EXIST')
@cloudfiles-me
cloudfiles-me / enable_s3_mfa_delete.txt
Created August 14, 2018 22:55
Enable MFS delete on S3 Bucket
aws s3api list-buckets
--query 'Buckets[*].Name'
aws s3api put-bucket-versioning
--bucket webapp-status-reports
--versioning-configuration '{"MFADelete":"Enabled","Status":"Enabled"}'
--mfa 'arn:aws:iam::aws_account_id:mfa/root-account-mfa-device passcode'
aws s3api get-bucket-versioning
--bucket webapp-status-reports
@cloudfiles-me
cloudfiles-me / to_open_cloudformation_resources_doc_in context.txt
Created August 13, 2018 16:43
Open Cloudformation Resource documentation
1. Create a .vscode folder in the cloudformation repository
2. Put this lines into .tasks.json into the .vscode folder
{
"version": "2.0.0",
"tasks": [
{
"label": "CF Type Search",
"type": "shell",
"command": "open -a \"Google Chrome\" \"https://docs.aws.amazon.com/search/doc-search.html?searchPath=documentation-guide&searchQuery=%22${selectedText}%22&x=0&y=0&this_doc_product=AWS+CloudFormation&this_doc_guide=User+Guide&doc_locale=en_us#facet_doc_product=AWS%20CloudFormation&facet_doc_guide=User%20Guide\"",
@cloudfiles-me
cloudfiles-me / .editorconfig
Created August 13, 2018 16:28
EditorConfig for VSCode to use in Cloudformation templates
# .editorconfig
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
@cloudfiles-me
cloudfiles-me / dec.py
Created August 6, 2018 23:39 — forked from nmarley/dec.py
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)