Member-only story

Troubleshooting and Fix the Terraform AWS Subscription Errors

Guidelines for Troubleshooting and Correcting AWS Subscription Hurdles with Terraform

Luca Berton
5 min readFeb 4, 2024

When deploying infrastructure as code using Terraform, encountering errors can be a common part of the development process. These errors, while initially frustrating, are valuable learning opportunities that can enhance your understanding of both Terraform and the underlying cloud services. One such error that users often face is related to AWS service subscriptions, as highlighted in the error message below:

aws_instance.app_server: Creating...

│ Error: creating EC2 Instance: OptInRequired: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe.
│ status code: 401, request id: b8e3c780-71f7-41c2-80e3-ea7a532b1ac4

│ with aws_instance.app_server,
│ on main.tf line 15, in resource "aws_instance" "app_server":
│ 15: resource "aws_instance" "app_server" {

This message indicates that the AWS account being used to create an EC2 instance via Terraform is not subscribed to the EC2 service. Here’s a step-by-step guide to understanding and resolving this issue:

Understanding the Error

  • OptInRequired: This part of the message tells you that the…

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet