INDEX
########################################################### 2024-01-04 00:20 ########################################################### Devops Toolkit... Running AWS Services in a Laptop using LocalStack https://www.youtube.com/watch?v=8hi9P1ffaQk Localstack lets you run AWS services/API locally - good for local testing # Install with helm (a took to manage kubernetes clusters) helm repo add localstack https://helm.localstack.cloud helm repo update helm upgrade --install localstack localstack/localstack --namespace localstack \ --create-namespace --values values.yaml # Then run the commands noted in that output (exports local ENV vars) export NODE_PORT=$(kubectl get --namespace localstack \ -o jsonpath="{.spec.ports[0].nodePort}" services localstack) # Something like 31566 export NODE_IP=$(kubectl ge t--namespace localstack \ -o jsonpath="{.items[0].status.addresses[0].address}") # 127.0.0.1 export LOCALSTACK_URL="http://$NODE_IP:$NODE_PORT" # http://127.0.0.1:31566 # values.yaml extraEnvVars: - name: LOCALSTACK_API_KEY value: ... - name: SERVICES value: s3,ec2,eks,iam,ecr,rds Local stacks act intentionally similar to AWS - need regionality and access keys export AWS_ACCESS_KEY_ID=test; export AWS_SECRET_ACCESS_KEY=test export AWS_DEFAULT_REGION=us-east-1 alias aws="aws --endpoint-url $LOCALSTACK_URL" # Makes things quicker aws s3api list-buckets aws s3api create-bucket --bucket dot aws s3api put-object --bucket dot --key silly --body silly.txt # Copy a file to bucket aws s3api get-object --bucket dot --key silly silly-from-s3.txt # Copy a file from bucket aws s3api list-objects --bucket dot # Lists contents of a bucket aws s3api delete-object --bucket dot --key silly aws s3api delete-bucket --bucket dot Now see if you can make a full scale database in Localstack aws rds create-db-instance --db-instance-identifier devops-toolkit \ --db-instance-class c1 --engine postgres aws rds describe-db-instance aws rds delete-db-instance --db-instance-identifier devops-toolkit Can make an eks (elastic kubernetes service) cluster aws eks create-cluster --name my-cluster --role-arn r1 --resources-vpc-config '{}' aws eks list-clusters aws eks describe-cluster --name my-cluster # See why this is failing by looking at kubernetes logs kubectl --namespace localstack logs --selector app.kubernetes.io/name=localstack --tail 100 Only issue is parts costs money to get this and lacks some features
########################################################### 2024-01-04 17:00 ########################################################### Localstack... Localstack 101 https://www.youtube.com/playlist?list=PLTew28KOwGxPqbkFiW518eeIfiV495bm0 Localstack is a local version of AWS - can interact exactly the same Faster and cheaper for local development Basically, install localstack and use the cli to interface with it docker pull localstack/localstack pip install awscli-local ... # Install localstack-cli localstack start -d # Start daemon awslocal s3api list-buckets awslocal s3 mb s3://test-bucket # Make new bucket awslocal s3api list-buckets # Can alternatively install it through docker docker run --rm -it -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack Can use the web app instead to manage your stack: app.localstack.cloud # Change endpoint URL in settings - e.g. localhsot.localstack.cloud:4566 # System status lets you see what services are being running Example project: [API gateway -> Lambda resources -> DynamoDB -> Lambda -> Gateway] Can save a whole cloud project to a zipped export loclastack pod save file://`pwd`/podfolder localstack pod load file://`pwd`/podfolder