Requirements
Credentials
Create Credentials
-
Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
-
In the navigation pane, choose Users.
-
Choose the name of the user whose access keys you want to create, and then choose the Security credentials tab.
-
In the Access keys section, choose Create access key.
-
To view the new access key pair, choose Show. You will not have access to the secret access key again after this dialog box closes. Your credentials will look something like this:
⋅⋅⋅ Access key ID: AKIAIOSFODNN7EXAMPLE
⋅⋅⋅ Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Use Files
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: ca-central-1
Default output format [None]: json
Credentials will be stored in this directory:
~/.aws
Use Environment Variables
export AWS_ACCESS_KEY_ID="AKIAIOSFODNN7EXAMPLE"
export AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
Usage
Cluster Creation
terraform init
terraform apply
Get kubeconfig
export KUBECONFIG="${PWD}/kubeconfig"
terraform output kubeconfig > "${KUBECONFIG}"
or
export KUBECONFIG="${PWD}/kubeconfig"
aws eks update-kubeconfig --name "$(terraform output cluster_name)" --kubeconfig "${KUBECONFIG}"
Try kubectl
kubectl get pods -A
Cleanup
terraform destroy