The aws-dev IAM user will be created with full EC2 permissions and Secrets Manager. The PEM file is stored in the Secrets Manager during the provisioning of EC2 instance by Terraform. EC2 permissions allows you to create and launch EC2 instances on your AWS account.
If you prefer to use the AWS console, you can follow the instructions on creating IAM Dev User. You can skip the instructions in this article.
If you prefer code instead of using the AWS console, you can run this code to create a IAM user that can be used to provision a server on EC2.
You can verify that the user is created by going to the IAM dashboard in the AWS console. Click on the aws-dev user and check the permissions are correct.
Copy the access keys printed in the terminal and set the environment variables:
The next step is to use the aws-dev user and the corresponding secrets keys for using Packer and Terraform. If the default image fits your needs, you don’t need to create a custom image using Packer. You can skip to the next step, running Terraform script.