Everything on the AWS pages of this site happens in KIMS's own AWS account, never in ours. Before any other AWS step you need two things: a way to sign in to that account, and the region KIMS has chosen.
#Who does what
| Task | Usually done by | What our engineer needs |
|---|---|---|
| Create your sign-in (Identity Center user or IAM user) and give it rights | KIMS's cloud team | Only the start URL or console link, your user name, and the account id |
| Decide the region | KIMS (it is the region their EKS cluster is in) | The region code: ap-south-2 or ap-south-1 |
| Set up the CLI profile on your laptop | Our engineer | Nothing more |
| Turn on MFA for your own sign-in | Our engineer, when first signing in | An authenticator app on your phone |
KIMS may give you no AWS access at all and run the AWS steps themselves. That is fine: every page in this section says which values we only need KIMS to give us. In that case, use this page only to explain to KIMS's team what to set up.
#The values to collect
| Value | Example | Who gives it | Used in |
|---|---|---|---|
| AWS account id | <AWS_ACCOUNT_ID> (12 digits) |
KIMS | Every ARN on these pages |
| Region | ap-south-2 (the region of KIMS's EKS cluster) |
KIMS | Every command, S3_REGION in the Helm values and in kims-site-env |
| IAM Identity Center start URL | https://<SSO_PORTAL>.awsapps.com/start |
KIMS | aws configure sso |
| Identity Center region | Often ap-south-1 or us-east-1 |
KIMS | aws configure sso |
| Permission set (role) you are given | KimsDeployer |
KIMS | aws configure sso |
| Or: console sign-in link for an IAM user | https://<AWS_ACCOUNT_ID>.signin.aws.amazon.com/console |
KIMS | Console sign-in |
#Choose the region
Everything goes in the region KIMS's EKS cluster is in, so the pods reach the database and the buckets without leaving it. The runbook on main (docs/ON-SITE-DEPLOYMENT.md, AWS set-up, Region) recommends:
| Region | Code | When |
|---|---|---|
| Asia Pacific (Hyderabad) | ap-south-2 |
Recommended: closest to KIMS, and the data stays in India. Use it if the cluster is there |
| Asia Pacific (Mumbai) | ap-south-1 |
Also in India, AWS's older Indian region with every service. Use it if the cluster is there |
Website visitors are served by CloudFront's edge locations wherever the bucket is, so the region matters for the CMS and the builds, not for the public site's speed.
Where the region is written in KIMS v2:
| Place | Value on main |
Change it when |
|---|---|---|
env.S3_REGION in values-production.example.yaml and values-uat.example.yaml |
ap-south-2 |
The cluster is in Mumbai |
S3_REGION in deploy/jenkins/site-env-production.example and site-env-uat.example (the kims-site-env credential) |
ap-south-2 |
The cluster is in Mumbai |
S3_REGION in deploy/handover/load-bundle-pod.yaml |
ap-south-2 |
The cluster is in Mumbai |
Code fallback when S3_REGION is unset (values.yaml, blob-store.ts, scripts/site-build/s3.mjs) |
ap-south-1 |
Never rely on it: always set S3_REGION |
The engineer's deploy.mjs kims content load helper |
Defaults to ap-south-1 |
Pass --region ap-south-2 when the buckets are in Hyderabad |
Differences between the two regions that matter on the day:
| Topic | ap-south-1 Mumbai |
ap-south-2 Hyderabad |
|---|---|---|
| Enabled by default | Yes | No. It is an opt-in region: the account owner must enable it (see below). If KIMS's cluster already runs there, it is enabled |
| EKS, ECR, RDS, S3, ACM | Available | Available |
| RDS for PostgreSQL 18 | Available | Check with the command in RDS first. If it is not offered, main's runbook says use PostgreSQL 17 there and tell ClinicSpots |
Instance types (for example Graviton m6g, t4g) |
Wide choice | Check with the commands on the RDS page |
Whatever the region, the website's certificate is always in us-east-1 (N. Virginia), because CloudFront only reads certificates from there (Certificates and DNS). Only the certificate is there, no data. You do not need to enable us-east-1: it is always on.
All the buckets, the database, the cluster and the registry for one environment must be in the same region, and that region must be S3_REGION. Otherwise presigned uploads from the CMS fail with a signature or redirect error.
#Check that an opt-in region is enabled
Only needed for ap-south-2. It needs the account:GetRegionOptStatus right, which KIMS's cloud team usually has and you may not.
aws account get-region-opt-status --region-name ap-south-2aws account get-region-opt-status --region-name ap-south-2aws account get-region-opt-status --region-name ap-south-2You should see "RegionOptStatus": "ENABLED". If it says DISABLED, the account owner enables it in the console: account menu (top right) > Account > AWS Regions > select Asia Pacific (Hyderabad) > Enable. It takes a few minutes to several hours.
#Option 1: IAM Identity Center (recommended)
Most companies with more than one AWS account sign people in through IAM Identity Center (formerly AWS SSO). You get short-lived credentials, nothing stored on your laptop is a long-lived key, and KIMS can remove your access in one place when the project ends.
#What KIMS's cloud team sets up
- In the IAM Identity Center console: Users > Add user, with your work email.
- Permission sets > Create permission set: a custom one for the deployment (see The rights you need), for example
KimsDeployer, session duration 8 or 12 hours. - AWS accounts > select KIMS's account > Assign users or groups > your user > the permission set > Submit.
You receive an email "Invitation to join AWS IAM Identity Center". Accept it, set your password and register an MFA device when asked.
#Sign in from the console
- Open the start URL (
https://<SSO_PORTAL>.awsapps.com/start). - Sign in, then approve the MFA prompt.
- On the AWS access portal, open the Accounts tab, expand KIMS's account, and choose the permission set name (for example KimsDeployer).
- The AWS console opens in that account. Check the account id in the top right menu.
- Choose the region in the region menu at the top right (for example Asia Pacific (Hyderabad) ap-south-2).
#Configure the CLI profile
You need AWS CLI v2 (AWS CLI install). The command is the same on every system; it asks questions one by one and opens your browser.
aws configure sso --profile kims-prodaws configure sso --profile kims-prodaws configure sso --profile kims-prodAnswer the prompts like this:
| Prompt | Answer |
|---|---|
SSO session name (Recommended): |
kims |
SSO start URL [None]: |
https://<SSO_PORTAL>.awsapps.com/start |
SSO region [None]: |
The Identity Center region KIMS gave you |
SSO registration scopes [sso:account:access]: |
Press Enter |
| (browser opens) | Check the code shown matches, then choose Confirm and continue and Allow access |
| Account list | Choose KIMS's account (if you have more than one) |
| Role list | Choose the permission set, for example KimsDeployer |
Default client Region [None]: |
ap-south-2 (or ap-south-1) |
CLI default output format [None]: |
json |
The profile is saved in your AWS config file: ~/.aws/config on Linux and macOS, %USERPROFILE%\.aws\config on Windows. It holds no secret. Repeat with --profile kims-uat if KIMS has a UAT environment in a different account or with a different permission set.
#Sign in again when the session ends
Sessions last as long as the permission set says (often 8 or 12 hours). When a command says Token has expired or The SSO session associated with this profile has expired:
aws sso login --profile kims-prodaws sso login --profile kims-prodaws sso login --profile kims-prodOn a machine with no browser (for example over SSH), add --use-device-code and open the printed URL on your own device.
#Option 2: an IAM user
Some teams do not use Identity Center. Then KIMS creates an IAM user for you.
#What KIMS's cloud team sets up
- IAM console > Users > Create user, user name for example
clinicspots-<YOUR_NAME>. - Tick Provide user access to the AWS Management Console, choose I want to create an IAM user, and let you set your own password at first sign-in.
- Permissions options: Attach policies directly or Add user to group, with the rights in The rights you need.
- Only if you need the CLI: on the user's page, Security credentials tab > Access keys > Create access key > Command Line Interface (CLI). The access key is shown once: KIMS hands it to you in person or through their password manager, never in chat or email.
#Turn on MFA for your IAM user
- Sign in with the console link
https://<AWS_ACCOUNT_ID>.signin.aws.amazon.com/console. - Top right menu > Security credentials.
- Multi-factor authentication (MFA) > Assign MFA device.
- Name it, choose Authenticator app, Next, scan the QR code, enter two codes in a row, Add MFA.
#Configure the CLI with the access key
aws configure prompts for the key without putting it in your shell history. Type it at the prompt; never paste it into a command line.
aws configure --profile kims-prodaws configure --profile kims-prodaws configure --profile kims-prod| Prompt | Answer |
|---|---|
AWS Access Key ID [None]: |
The key id KIMS gave you |
AWS Secret Access Key [None]: |
The secret key (it is not shown back) |
Default region name [None]: |
ap-south-2 (or ap-south-1) |
Default output format [None]: |
json |
This writes the key in plain text to ~/.aws/credentials (%USERPROFILE%\.aws\credentials on Windows). When the project ends, ask KIMS to delete the access key, and delete the file's [kims-prod] section yourself.
If KIMS's policy requires MFA for CLI calls too, they will give you a role to assume with MFA. Add it to ~/.aws/config like this (no secret in it), and the CLI asks for the six-digit code when needed:
[profile kims-prod-mfa]
source_profile = kims-prod
role_arn = arn:aws:iam::<AWS_ACCOUNT_ID>:role/<ROLE_KIMS_GIVES_YOU>
mfa_serial = arn:aws:iam::<AWS_ACCOUNT_ID>:mfa/<YOUR_MFA_DEVICE_NAME>
region = ap-south-2#Use the profile in every command
Either add --profile kims-prod to each command, or set it once for the terminal window. The commands on the other AWS pages assume you set it once.
export AWS_PROFILE=kims-prod
export AWS_REGION=ap-south-2export AWS_PROFILE=kims-prod
export AWS_REGION=ap-south-2$env:AWS_PROFILE = "kims-prod"
$env:AWS_REGION = "ap-south-2"These last only for the current terminal window. Open a new window and set them again.
#Check you are in the right account
Run this before every session of AWS work. It is read-only and always allowed.
aws sts get-caller-identityaws sts get-caller-identityaws sts get-caller-identityYou should see something like:
{
"UserId": "AROAEXAMPLEID:you@clinicspots.com",
"Account": "<AWS_ACCOUNT_ID>",
"Arn": "arn:aws:sts::<AWS_ACCOUNT_ID>:assumed-role/AWSReservedSSO_KimsDeployer_0123456789abcdef/you@clinicspots.com"
}Accountmust be KIMS's account id, not ClinicSpots'. If it is not, stop: you are about to create things in the wrong account.- With an IAM user,
Arnends:user/<your user name>instead.
Check the region too:
aws configure get regionaws configure get regionaws configure get regionIt prints the profile's region. AWS_REGION in your terminal, if set, wins over it.
#The rights you need
Only if KIMS asks us to create AWS resources ourselves. Ask for the narrowest set that covers the pages you will actually do. A practical permission set for a deployment, which KIMS can tighten to their own resource names:
| Page | Services and rights |
|---|---|
| ECR | ecr:* on repositories named kims/* |
| RDS | rds:* on instances named kims-*, plus ec2:Describe* and ec2:CreateSecurityGroup, ec2:AuthorizeSecurityGroupIngress |
| S3 buckets | s3:* on buckets named kims-* |
| IAM | iam:CreateRole, iam:PutRolePolicy, iam:GetRole, iam:UpdateAssumeRolePolicy, iam:PassRole on roles named kims-*; iam:ListOpenIDConnectProviders |
| Certificates and DNS | acm:RequestCertificate, acm:DescribeCertificate, acm:ListCertificates |
| CloudFront | cloudfront:* and cloudfront-keyvaluestore:* |
| EKS | eks:DescribeCluster, eks:ListClusters, plus an EKS access entry for you in the kims namespace |
Read-only alternative: if KIMS does the creating, the AWS managed policy ReadOnlyAccess lets you run every check on these pages.
#If it goes wrong
| What you see | Likely cause | What to do |
|---|---|---|
Unable to locate credentials |
No profile set in this terminal | Set AWS_PROFILE (above) or add --profile |
The config profile (kims-prod) could not be found |
Profile name typo, or the config file is in another user's home | aws configure list-profiles lists the names you have |
Token has expired and refresh failed |
The SSO session ended | aws sso login --profile kims-prod |
An error occurred (ExpiredToken) |
IAM user temporary credentials, or an assumed role, expired | Run the command again; the CLI asks for a new MFA code |
InvalidClientTokenId |
The access key was deleted or mistyped | aws configure --profile kims-prod again with the right key |
AccessDenied on one command |
Your permission set lacks that action | Send KIMS the full error line: it names the action and the resource |
Could not connect to the endpoint URL: "https://...ap-south-2..." |
The region is not enabled for the account | Check that an opt-in region is enabled |
The browser never opens on aws configure sso |
Headless machine or a locked-down browser | Copy the URL and code it prints into any browser, or use --use-device-code |
Windows: aws is not recognised |
CLI not installed, or the window opened before installing | AWS CLI install, then open a new PowerShell window |
#Sources
kims-v2/deploy/helm/kims/values.yaml,kims-v2/deploy/helm/kims/values-production.example.yaml,kims-v2/deploy/helm/kims/values-uat.example.yamlkims-v2/deploy/jenkins/site-env-production.examplekims-v2/deploy/handover/load-bundle-pod.yamlkims-v2/packages/content/src/media/blob-store.ts,kims-v2/scripts/site-build/s3.mjskims-v2/docs/ON-SITE-DEPLOYMENT.md(AWS set-up, Region),kims-v2/docs/CONFIG.md- https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html
- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
- https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html
- https://docs.aws.amazon.com/singlesignon/latest/userguide/getting-started.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html
- https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html
- https://docs.aws.amazon.com/cli/latest/reference/sts/get-caller-identity.html