Edit ~/.aws/credentials
as follows.
Define just one entry.
# ...
[adceet]
aws_access_key_id=xxxxx
aws_secret_access_key=xxxxx
aws_session_token=xxxxx
Define one for terraform and one for SSO separately.
~/.aws/config
[profile adceet-sso]
sso_start_url = https://xxxxx.awsapps.com/start
sso_region = us-east-1
sso_account_id = 1234567890
sso_role_name = XxxxOwnerAccess
region = us-east-1
~/.aws/credentials
# ...
[adceet]
aws_access_key_id=xxxxx
aws_secret_access_key=xxxxx
aws_session_token=xxxxx
# ...
# ...
# ...
[adceet-sso]
aws_access_key_id=xxxxx
aws_secret_access_key=xxxxx
aws_session_token=xxxxx
$ cp env.sh.default env.sh
Modify PREFIX, APPLICATION_NAME as appropriate. If you want to create a personal environment, change PREFIX.
Should use the same value for AWS_PROFILE_SSO
as to AWS_PROFILE
.
export AWS_PROFILE=adceet
export AWS_PROFILE_SSO=adceet
export AWS_REGION=us-east-1
export AWS_ACCOUNT_ID=1234567890
export PREFIX=om2eep1k
export APPLICATION_NAME=adceet
export MODE=scala
if [[ "$OUTPUT_ENV" == 1 ]]; then
echo "--- Using Environments -----------------"
echo "AWS_PROFILE = $AWS_PROFILE"
echo "AWS_PROFILE_SSO = $AWS_PROFILE_SSO"
echo "AWS_REGION = $AWS_REGION"
echo "PREFIX = $PREFIX"
echo "APPLICATION_NAME = $APPLICATION_NAME"
echo "MODE = $MODE"
echo "----------------------------------------"
fi
Should specify a profile name for AWS SSO to AWS_PROFILE_SSO
.
export AWS_PROFILE=adceet
export AWS_PROFILE_SSO=adceet-sso
Create a new file akka-dddcqrs-es-example-typed/tools/terraform/${PREFIX}-${APPLICATION_NAME}-terraform.tfvars
with the following.
Changes defined in variables.tf can be overridden in this tfvars file.
You can create only the resources you need. For example, just set ecr_enabled = true
if you only need ecr.
akka_persistence_enabled = true
akka_persistence_journal_name = "Journal"
akka_persistence_journal_gsi_name = "GetJournalRowsIndex"
akka_persistence_snapshot_name = "Snapshot"
akka_persistence_snapshot_gsi_name = "GetSnapshotRowsIndex"
eks_enabled = true
eks_version = "1.22"
eks_auth_roles = []
eks_auth_users = []
eks_auth_accounts = []
ecr_enabled = true
datadog-api-key = "xxxx"
At first time only, Create a lock table for terraform on DynamoDB.
tools/terraform $ ./create-lock-table.sh
At first time only, Create an s3 bucket to store tfstate.
tools/terraform $ ./create-tf-bucket.sh
tools/terraform $ ./terraform-init.sh
tools/terraform $ ./terraform-plan.sh
tools/terraform $ ./terraform-apply.sh
Execute the following command to generate kubeconfig(~/.kube/config
).
tools/terraform $ ./update-kubeconfig.sh
FYI: https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html
Verify that the context has switched.
tools/terraform $ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* arn:aws:eks:us-east-1:XXXXXXXXXXXX:cluster/oce3noy9-eks-adceet arn:aws:eks:us-east-1:XXXXXXXXXXXX:cluster/oce3noy9-eks-adceet arn:aws:eks:us-east-1:XXXXXXXXXXXX:cluster/oce3noy9-eks-adceet
docker-desktop docker-desktop docker-desktop
$ DASHBOARD_NS=kubernetes-dashboard
$ export POD_NAME=$(kubectl get pods -n $DASHBOARD_NS -l "app.kubernetes.io/name=kubernetes-dashboard,app.kubernetes.io/instance=kubernetes-dashboard" -o jsonpath="{.items[0].metadata.name}")
$ kubectl -n $DASHBOARD_NS port-forward $POD_NAME 8443:8443
- Open
chrome://flags/#allow-insecure-localhost
Allow invalid certificates for resources loaded from localhost.
isEnable
- Relaunch
- Open
https://localhost:8443
$ DASHBOARD_NS=kubernetes-dashboard
$ kubectl -n $DASHBOARD_NS describe secret $(kubectl -n $DASHBOARD_NS get secret | grep kubernetes-dashboard-token | awk '{print $1}') | awk '$1=="token:"{print $2}'