Create Access key and Secret key

In this section, you will generate AWS credentials and configure GitHub Actions repository secrets. These secrets allow your GitHub Actions deployment pipelines to securely authenticate with Amazon ECR, publish container images, register updated Amazon ECS task definitions, and trigger zero-downtime rolling service updates.


Step 1: Create an IAM access key in AWS

To allow an external runner like GitHub Actions to execute deployment commands against your AWS environment, you must provide programmatic access credentials.

  1. Log in to the AWS Management Console.

  2. In the top-right navigation bar, click your account name or ID dropdown menu and select Security credentials.

    AWS console navigation to security credentials

  3. Scroll down to the Access keys section and click Create access key.

    Create access key button in IAM

  4. In the Access key best practices & alternatives step, select the Third-party service use case option.

  5. Check the confirmation checkbox acknowledging AWS recommendations, then click Next.

    Select third-party service use case

  6. (Optional) In the Description tag value field, enter Access key for GitHub Actions.

  7. Click Create access key.

    Set description tag for access key

  8. In the Retrieve access keys step, your new credential pair is generated:

    • Access key
    • Secret access key
  9. Click Download .csv file to save a copy locally, or copy both values to a secure location.

    Retrieve access keys and download CSV file

  10. Click Done. Your new access key now appears in the active credentials list.

    Active access keys list in IAM console

This is the only time the secret access key can be viewed or downloaded from the AWS console. If you navigate away without saving it, AWS cannot recover the value, and you will need to deactivate the key pair and generate a new one. Never commit access keys to public repositories or unencrypted scripts.


Step 2: Configure repository secrets in GitHub

GitHub Actions uses encrypted repository secrets to inject credentials and infrastructure identifiers into CI/CD workflows at runtime without exposing them in plaintext code.

  1. In your web browser, navigate to your aws-fcaj-container-app repository on GitHub.

  2. Click the Settings tab in the top repository navigation bar.

    GitHub repository settings tab

  3. In the left navigation menu, expand Secrets and variables and select Actions.

  4. In the Repository secrets section, click New repository secret.

  5. Add each of the following 11 secrets by entering the exact secret name and its corresponding value:

Secret Name Description Example / Target Value
AWS_ACCESS_KEY_ID IAM programmatic access key ID AKIA... (from downloaded CSV)
AWS_SECRET_ACCESS_KEY IAM programmatic secret access key wJalr... (from downloaded CSV)
AWS_ACCOUNT_NUMBER 12-digit AWS account ID without hyphens 123456789012
AWS_REGION AWS Region where lab resources reside us-east-1 (or your active lab region)
CLUSTER_NAME Target Amazon ECS cluster name FCAJ-Lab-cluster
SERVICE_NAME_FE Amazon ECS service name for frontend app-frontend
SERVICE_NAME_BE Amazon ECS service name for backend app-backend
TASK_NAME_FE Amazon ECS task definition family for frontend FCAJResbar-task-fe
TASK_NAME_BE Amazon ECS task definition family for backend FCAJResbar-task-be
CI_PROJECT_FE_NAME Amazon ECR repository name for frontend aws-fcaj-container-app-frontend
CI_PROJECT_BE_NAME Amazon ECR repository name for backend aws-fcaj-container-app-backend

Configured repository secrets in GitHub Actions

To quickly retrieve your 12-digit AWS account ID from your EC2 build instance terminal, run: aws sts get-caller-identity --query "Account" --output text