{"id":9693,"date":"2026-01-20T05:28:03","date_gmt":"2026-01-19T23:58:03","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=9693"},"modified":"2026-01-20T05:28:41","modified_gmt":"2026-01-19T23:58:41","slug":"how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/","title":{"rendered":"How to Create an AWS EC2 Instance Using Terraform in Ubuntu"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Terraform is an infrastructure-as-code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like compute, storage, and networking resources, as well as high-level components like DNS entries and SaaS features.<\/p>\n\n\n\n<p><strong>Terraform<\/strong>, developed by HashiCorp, allows you to define and provision cloud resources using simple, declarative configuration files. With Terraform, infrastructure becomes <strong>version-controlled, repeatable, and automated<\/strong>, making it a core tool for <strong>DevOps engineers and system administrators<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites:<\/h2>\n\n\n\n<p>Before you begin, ensure the following requirements are met:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An <strong>active AWS account<\/strong><\/li>\n\n\n\n<li>An <strong>IAM user<\/strong> with:<br>Programmatic access<br>EC2, VPC, and Elastic IP permissions<\/li>\n\n\n\n<li>Ubuntu Linux<\/li>\n\n\n\n<li>Basic knowledge of:<br>Linux commands<br>AWS EC2 concepts<br>SSH access<br><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Install AWS CLI (Ubuntu)<\/h2>\n\n\n\n<p>Terraform uses AWS credentials configured via the AWS CLI to authenticate with AWS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update System Packages<\/h2>\n\n\n\n<p>This step updates the local package index and installs required utilities (<code>curl<\/code> and <code>unzip<\/code>) that are needed to download and extract the AWS CLI installer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\napt install -y curl unzip<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Download AWS CLI v2<\/h2>\n\n\n\n<p>Download the official AWS CLI v2 installer package from AWS to the local system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl \"https:\/\/awscli.amazonaws.com\/awscli-exe-linux-x86_64.zip\" -o awscliv2.zip<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install AWS CLI<\/h2>\n\n\n\n<p>Extract the downloaded package and run the installation script to install AWS CLI v2 system-wide.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip awscliv2.zip\n.\/aws\/install<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Verify Installation<\/h2>\n\n\n\n<p>Confirm that AWS CLI is installed successfully and check the installed version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws --version<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configure AWS Credentials<\/h2>\n\n\n\n<p>Run the following command and provide your IAM credentials:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws configure<\/code><\/pre>\n\n\n\n<p>Enter:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>AWS Access Key ID<\/strong><\/li>\n\n\n\n<li><strong>AWS Secret Access Key<\/strong><\/li>\n\n\n\n<li><strong>Default region name:<\/strong> <code>ap-south-1<\/code><\/li>\n\n\n\n<li><strong>Default output format:<\/strong>json<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Install Terraform<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Add HashiCorp Repository<\/h2>\n\n\n\n<p>Add HashiCorp\u2019s official GPG key and repository so Terraform can be installed and updated securely using <code>apt<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -O - https:\/\/apt.releases.hashicorp.com\/gpg | sudo gpg --dearmor -o \/usr\/share\/keyrings\/hashicorp-archive-keyring.gpg\necho \"deb &#091;arch=$(dpkg --print-architecture) signed-by=\/usr\/share\/keyrings\/hashicorp-archive-keyring.gpg] https:\/\/apt.releases.hashicorp.com $(grep -oP '(?&lt;=UBUNTU_CODENAME=).*' \/etc\/os-release || lsb_release -cs) main\" | sudo tee \/etc\/apt\/sources.list.d\/hashicorp.list\nsudo apt update &amp;&amp; sudo apt install terraform<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Install Terraform<\/h2>\n\n\n\n<p>Update the package list and install Terraform from the official HashiCorp repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update\napt install terraform -y<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Verify Installation<\/h2>\n\n\n\n<p>Verify that Terraform is installed correctly by checking its version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform -v<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Terraform Project Structure<\/h2>\n\n\n\n<p>Create a dedicated project directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir terraform-ec2 &amp;&amp; cd terraform-ec2<\/code><\/pre>\n\n\n\n<p>Project structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform-ec2\/<br>\u251c\u2500\u2500 provider.tf<br>\u251c\u2500\u2500 variables.tf<br>\u251c\u2500\u2500 main.tf<br>\u251c\u2500\u2500 outputs.tf<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Terraform Configuration Files<\/h2>\n\n\n\n<p><strong>provider.tf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>provider &#8220;aws&#8221; {<br>region = &#8220;ap-south-1&#8221;<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>variables.tf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>variable &#8220;ami_id&#8221; {<br>default = &#8220;ami-0f5ee92e2d63afc18&#8221;<br>}<br>variable &#8220;instance_type&#8221; {<br>default = &#8220;t2.micro&#8221;<br>}<br>variable &#8220;key_name&#8221; {<br>default = &#8220;my-keypair&#8221;<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>main.tf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>resource &#8220;aws_security_group&#8221; &#8220;ec2_sg&#8221; {<br>name = &#8220;terraform-sg&#8221;<br>ingress {<br>from_port = 22<br>to_port = 22<br>protocol = &#8220;tcp&#8221;<br>cidr_blocks = [&#8220;0.0.0.0\/0&#8221;]<br>}<br>ingress {<br>from_port = 80<br>to_port = 80<br>protocol = &#8220;tcp&#8221;<br>cidr_blocks = [&#8220;0.0.0.0\/0&#8221;]<br>}<br>egress {<br>from_port = 0<br>to_port = 0<br>protocol = &#8220;-1&#8221;<br>cidr_blocks = [&#8220;0.0.0.0\/0&#8221;]<br>}<br>}<br>resource &#8220;aws_instance&#8221; &#8220;ec2&#8221; {<br>ami = var.ami_id<br>instance_type = var.instance_type<br>key_name = var.key_name<br>vpc_security_group_ids = [aws_security_group.ec2_sg.id]<br>tags = {<br>Name = &#8220;Terraform-EC2&#8221;<br>}<br>}<br>resource &#8220;aws_eip&#8221; &#8220;eip&#8221; {<br>instance = aws_instance.ec2.id<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>outputs.tf<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>output &#8220;public_ip&#8221; {<br>value = aws_eip.eip.public_ip<br>}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Deploy the Infrastructure<\/h2>\n\n\n\n<p>Initialize Terraform:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform init<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"823\" height=\"305\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png\" alt=\"\" class=\"wp-image-9694\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png 823w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-300x111.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-768x285.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-810x300.png 810w\" sizes=\"auto, (max-width: 823px) 100vw, 823px\" \/><\/a><\/figure>\n\n\n\n<p>Preview the execution plan:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform plan<\/code><\/pre>\n\n\n\n<p>Apply the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform apply<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"850\" height=\"275\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-1.png\" alt=\"\" class=\"wp-image-9695\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-1.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-1-300x97.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-1-768x248.png 768w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/a><\/figure>\n\n\n\n<p>Type <strong>yes<\/strong> when prompted.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verification<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login to <strong>AWS Console<\/strong><\/li>\n\n\n\n<li>Navigate to <strong>EC2 \u2192 Instances<\/strong><\/li>\n\n\n\n<li>Verify:<br>Instance is running<br>Security group is attached<br>Elastic IP is assigned<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"40\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-1024x40.png\" alt=\"\" class=\"wp-image-9696\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-1024x40.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-300x12.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-768x30.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-1536x59.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2-850x33.png 850w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image-2.png 1577w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">SSH Access<\/h2>\n\n\n\n<p>Use the private key (<code>.pem<\/code> file) associated with your EC2 instance to establish an SSH connection.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -i my-keypair.pem ubuntu@&lt;Elastic-IP&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Cleanup Resources<\/h2>\n\n\n\n<p>To avoid unnecessary AWS charges, destroy all resources when no longer needed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>terraform destroy<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion:<\/h2>\n\n\n\n<p>Terraform simplifies cloud infrastructure management by enabling <strong>automation, consistency, and scalability<\/strong>. In this guide, we successfully created an <strong>AWS EC2 instance using Terraform<\/strong>, complete with security groups and an Elastic IP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Terraform is an infrastructure-as-code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">How to Create an AWS EC2 Instance Using Terraform in Ubuntu<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":510,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-9693","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-uncategorized","7":"h-entry","9":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Introduction Terraform is an infrastructure-as-code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like&hellip; Continue Reading How to Create an AWS EC2 Instance Using Terraform in Ubuntu\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-19T23:58:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T23:58:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"823\" \/>\n\t<meta property=\"og:image:height\" content=\"305\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Naveen Prasad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveen Prasad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/\"},\"author\":{\"name\":\"Naveen Prasad\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e0b107d557060d31788b0abd1965e55\"},\"headline\":\"How to Create an AWS EC2 Instance Using Terraform in Ubuntu\",\"datePublished\":\"2026-01-19T23:58:03+00:00\",\"dateModified\":\"2026-01-19T23:58:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/\"},\"wordCount\":549,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/image.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/image.png\",\"datePublished\":\"2026-01-19T23:58:03+00:00\",\"dateModified\":\"2026-01-19T23:58:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#primaryimage\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/image.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/image.png\",\"width\":823,\"height\":305},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create an AWS EC2 Instance Using Terraform in Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/7e0b107d557060d31788b0abd1965e55\",\"name\":\"Naveen Prasad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g\",\"caption\":\"Naveen Prasad\"},\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/naveen-prasad\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Introduction Terraform is an infrastructure-as-code tool that lets you define both cloud and on-prem resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like&hellip; Continue Reading How to Create an AWS EC2 Instance Using Terraform in Ubuntu","og_url":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2026-01-19T23:58:03+00:00","article_modified_time":"2026-01-19T23:58:41+00:00","og_image":[{"width":823,"height":305,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png","type":"image\/png"}],"author":"Naveen Prasad","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"Naveen Prasad","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/"},"author":{"name":"Naveen Prasad","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/7e0b107d557060d31788b0abd1965e55"},"headline":"How to Create an AWS EC2 Instance Using Terraform in Ubuntu","datePublished":"2026-01-19T23:58:03+00:00","dateModified":"2026-01-19T23:58:41+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/"},"wordCount":549,"commentCount":0,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/","url":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#primaryimage"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#primaryimage"},"thumbnailUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png","datePublished":"2026-01-19T23:58:03+00:00","dateModified":"2026-01-19T23:58:41+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#primaryimage","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2026\/01\/image.png","width":823,"height":305},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-ec2-instance-using-terraform-in-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Create an AWS EC2 Instance Using Terraform in Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/7e0b107d557060d31788b0abd1965e55","name":"Naveen Prasad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c040d480588ba05e6689aa14fcc899bd3507bbd0fd2e7f7ee38e6b6b8e264f6e?s=96&r=g","caption":"Naveen Prasad"},"url":"https:\/\/pheonixsolutions.com\/blog\/author\/naveen-prasad\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-2wl","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/510"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=9693"}],"version-history":[{"count":3,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9693\/revisions"}],"predecessor-version":[{"id":9699,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9693\/revisions\/9699"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=9693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=9693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=9693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}