Creating a Service Account on AWS For Terraform
Published: 2024-03-03 10:31:52

## Overview

For Terraform to create resources on your AWS account, it should get some access keys to authenticate to your account. In this step, we will create a service account for Terraform to use.

We will create an admin user group, then create a Terraform user and add it to the admin group. Then create access keys for the Terraform user. You can follow the steps below to create them all.

When you are in the AWS Console, search for the IAM service.

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/1-go-to-iam.png)

Head to "User groups" and click on the "Create group" button.

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/2-create-group-menu.png)

Enter your group name, search for `administratorAccess` and select it, and hit the "Create group" button.

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/3-create-group.png)

Click on the "Users" menu, then click the "Create user" button to create a user for Terraform.

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/4-create-user-menu.png)

Enter the "User name" and hit the "Next" button.

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/5-username.png)

Add the new user to the group previously created. So the user will have "Administrator Access" permissions.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/6-add-user-group.png)

Review the user and hit "Create user" to continue.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/7-create-user.png)

To create a access keys for the new user, hit the username.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/8-user-details.png)

Change the tab to "Security credentials" and hit the "Create access key" button.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/9-create-access-menu.png)

Change the "Other" type and hit the "Next" button.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/10-access-use-case.png)

You can write a description of why you have created this access key. Hit the "Create access key" button to continue.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/11-description.png)

Now you can see the access keys. Copy both of them and paste them somewhere else securely. Hit "Done" to continue.  

![](https://cdn.jsdelivr.net/gh/burakberkkeskin/blog-cdn/how-to-create-a-service-account-on-aws-for-terraform/create-terraform-service-account/12-access-keys.png)

You can use those keys in the Terraform configuration.

❗Keep these access keys safe and secure. Whoever gets access to the keys controls all resources on your AWS account.

If you enjoyed this DevOps article and crave more insights into System Administration, visit my blog for additional resources and tutorials. Thank you for exploring the world of efficient software development with me, and stay tuned for more on my blog!

https://burakberk.dev