Skip to content

Instantly share code, notes, and snippets.

@enderandpeter
Last active April 29, 2020 13:43
Show Gist options
  • Save enderandpeter/2d7b241e3a0c6b5fbce1b880fd6b73b6 to your computer and use it in GitHub Desktop.
Save enderandpeter/2d7b241e3a0c6b5fbce1b880fd6b73b6 to your computer and use it in GitHub Desktop.
Udacity FSND EKS Cluster and IAM Role Creation with Powershell
eksctl create cluster --name simple-jwt-api
$env:ACCOUNT_ID = aws sts get-caller-identity --query Account --output text
$env:TRUST = "{ \`"Version\`": \`"2012-10-17\`", \`"Statement\`": [ { \`"Effect\`": \`"Allow\`", \`"Principal\`": { \`"AWS\`": \`"arn:aws:iam::${env:ACCOUNT_ID}:root\`" }, \`"Action\`": \`"sts:AssumeRole\`" } ] }"
aws iam create-role --role-name UdacityFlaskDeployCBKubectlRole --assume-role-policy-document "$env:TRUST" --output text --query 'Role.Arn'
echo '{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "eks:Describe*", "ssm:GetParameters" ], "Resource": "*" } ] }' > $env:temp\iam-role-policy
aws iam put-role-policy --role-name UdacityFlaskDeployCBKubectlRole --policy-name eks-describe --policy-document file://$env:temp\iam-role-policy
kubectl get -n kube-system configmap/aws-auth -o yaml > $env:temp\aws-auth-patch.yml
kubectl patch configmap/aws-auth -n kube-system --patch $(Get-Content $env:temp\aws-auth-patch.yml -Raw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment