Creating Access Key, Role, and Key Pair

Creating an Access Key

First, we need to create an Access Key to access the AWS console via the Command Line Interface (CLI). This Access Key will enable us to manage and interact with AWS services easily from the command line.

  • Go to the AWS Console and search for IAM.
  • Select the User you are currently using.
  • Go to Security credentials, scroll down, and choose Create access key.

image

  • Select Command Line Interface (CLI).

image

  • Check the Confirmation box and click Next.

image

  • Click Create access key.

image

  • Complete the creation of the access key and download the file containing the access key.
  • Select Done to finish.

image

Creating a Role

Next, we will create a Role to grant permissions for the ECS service that we will use later.

  • Select Roles and click Create role.

image

  • Choose AWS service as the type.
  • Select CodeDeploy as the service.
  • Select CodeDeploy - ECS as the use case.

image

  • You will see a pre-created policy.
  • Click Next.

image

  • Enter the name: CodeDeployServiceRole.
  • Enter the description: Allows CodeDeploy to read S3 objects, invoke Lambda functions, publish to SNS topics, and update ECS services on your behalf.

image

  • Review and click Create role.

image

Creating a Key Pair

Create a key pair to use with your EC2 instance.

  • In the search bar, enter Key pair.
  • Select Key pairs.

image

  • Select Key Pairs.
  • Click Create key pair.

image

  • Enter the name: terraform-cicd.
  • Select type RSA.
  • Choose file type .pem.
  • Click Create key pair.

image

  • The Key pair creation is successful.

image