{"id":14195,"date":"2020-05-26T06:40:53","date_gmt":"2020-05-26T04:40:53","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/"},"modified":"2020-05-26T06:40:53","modified_gmt":"2020-05-26T04:40:53","slug":"automate-aws-deployment-with-ansible-terraform","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/","title":{"rendered":"Automate AWS deployments with Ansible + Terraform"},"content":{"rendered":"<h1>Automate AWS deployments with Ansible + Terraform<\/h1>\n<p>This installation is made from a bastion server already available with the proper network permissions.<br \/>\nFor different deployment types, you should adapt it to your need.<\/p>\n<h2 id=\"install-requirements\">Install requirements<\/h2>\n<p>Ansible installation:<\/p>\n<pre><code class=\"lang-bash\">sudo apt <span class=\"hljs-keyword\">update<\/span>\nsudo apt <span class=\"hljs-keyword\">install<\/span> -y software-properties-common\nsudo apt-<span class=\"hljs-keyword\">add<\/span>-repository <span class=\"hljs-comment\">--yes --update ppa:ansible\/ansible<\/span>\nsudo apt <span class=\"hljs-keyword\">install<\/span> -y ansible\n<\/code><\/pre>\n<p>ref: <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/installation_guide\/intro_installation.html#installing-ansible-on-ubuntu\">https:\/\/docs.ansible.com\/ansible\/latest\/installation_guide\/intro_installation.html#installing-ansible-on-ubuntu<\/a><\/p>\n<p>Terraform installation:<\/p>\n<pre><code class=\"lang-bash\">wget <span class=\"hljs-string\">https:<\/span><span class=\"hljs-comment\">\/\/releases.hashicorp.com\/terraform\/0.12.24\/terraform_0.12.24_linux_amd64.zip<\/span>\nsudo unzip -d <span class=\"hljs-regexp\">\/usr\/<\/span>local<span class=\"hljs-regexp\">\/bin\/<\/span> .\/terraform_0<span class=\"hljs-number\">.12<\/span><span class=\"hljs-number\">.24<\/span>_linux_amd64.zip\n<\/code><\/pre>\n<p>ref: <a href=\"https:\/\/www.techrepublic.com\/article\/how-to-install-terraform-on-ubuntu-server\/\">https:\/\/www.techrepublic.com\/article\/how-to-install-terraform-on-ubuntu-server\/<\/a><\/p>\n<p>AWS Client installation:<\/p>\n<pre><code class=\"lang-bash\">curl <span class=\"hljs-string\">\"https:\/\/awscli.amazonaws.com\/awscli-exe-linux-x86_64.zip\"<\/span> -o <span class=\"hljs-string\">\"awscliv2.zip\"<\/span>\nunzip awscliv2<span class=\"hljs-selector-class\">.zip<\/span>\nsudo .\/aws\/install\n<\/code><\/pre>\n<p>ref: <a href=\"https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/install-cliv2-linux.html\">https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/install-cliv2-linux.html<\/a><\/p>\n<h2 id=\"connect-your-environment-to-your-aws-cloud\">Connect your environment to your AWS cloud<\/h2>\n<pre><code class=\"lang-bash\">$ aws configure\nAWS <span class=\"hljs-keyword\">Access<\/span> Key ID [<span class=\"hljs-keyword\">None<\/span>]: AKIAIOSFODNN7EXAMPLE\nAWS Secret <span class=\"hljs-keyword\">Access<\/span> Key [<span class=\"hljs-keyword\">None<\/span>]: wJalrXUtnFEMI\/K7MDENG\/bPxRfiCYEXAMPLEKEY\n<span class=\"hljs-keyword\">Default<\/span> region <span class=\"hljs-keyword\">name<\/span> [<span class=\"hljs-keyword\">None<\/span>]: eu-central-a\n<span class=\"hljs-keyword\">Default<\/span> output <span class=\"hljs-keyword\">format<\/span> [<span class=\"hljs-keyword\">None<\/span>]: json\n<\/code><\/pre>\n<p>ref: <a href=\"https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/cli-chap-configure.html#cli-quick-configuration\">https:\/\/docs.aws.amazon.com\/cli\/latest\/userguide\/cli-chap-configure.html#cli-quick-configuration<\/a><\/p>\n<h2 id=\"create-a-new-ansible-project\">Create a new Ansible project<\/h2>\n<p>That is my favorite Ansible layout. The one I&#8217;ve seen as the best so far:<\/p>\n<pre><code class=\"lang-bash\">mkdir -<span class=\"hljs-selector-tag\">p<\/span> ~\/my_aws_project\/inventory\nmkdir -<span class=\"hljs-selector-tag\">p<\/span> ~\/my_aws_project\/playbooks\nmkdir -<span class=\"hljs-selector-tag\">p<\/span> ~\/my_aws_project\/roles\n<\/code><\/pre>\n<h2 id=\"add-the-ec2-dynamic-inventory\">Add the EC2 dynamic inventory<\/h2>\n<p>Ansible can work with a different kind of inventory called the dynamic inventory.<br \/>\nInstead of having a static declaration in a static file of your inventory, you can generate it from a source.<br \/>\nThis source can be a database, an active directory, etc. A dynamic inventory is a scrip that outputs a JSON in a structure that Ansible can handle. We could then develop a script that discovers our EC2 infrastructure that would take some time. Or we can use the one already provide with Ansible:<\/p>\n<p>Install prerequisites:<\/p>\n<pre><code class=\"lang-bash\">sudo apt <span class=\"hljs-keyword\">install<\/span> -y python3-pip\nsudo pip3 <span class=\"hljs-keyword\">install<\/span> boto\nsudo pip3 <span class=\"hljs-keyword\">install<\/span> ansible\nsudo rm \/usr\/<span class=\"hljs-keyword\">bin<\/span>\/python\nsudo <span class=\"hljs-keyword\">ln<\/span> -s \/usr\/<span class=\"hljs-keyword\">bin<\/span>\/python3 \/usr\/<span class=\"hljs-keyword\">bin<\/span>\/python\n<\/code><\/pre>\n<p>Get the EC2 dynamic inventory:<\/p>\n<pre><code class=\"lang-bash\">wget -O ~<span class=\"hljs-regexp\">\/my_aws_project\/inventory<\/span><span class=\"hljs-regexp\">\/ec2.py \\\nhttps:\/<\/span><span class=\"hljs-regexp\">\/raw.githubusercontent.com\/ansible<\/span><span class=\"hljs-regexp\">\/ansible\/stable<\/span>-<span class=\"hljs-number\">2.9<\/span>\/contrib\/inventory\/ec2.py\nwget -O ~<span class=\"hljs-regexp\">\/my_aws_project\/inventory<\/span><span class=\"hljs-regexp\">\/ec2.ini \\\nhttps:\/<\/span><span class=\"hljs-regexp\">\/raw.githubusercontent.com\/ansible<\/span><span class=\"hljs-regexp\">\/ansible\/stable<\/span>-<span class=\"hljs-number\">2.9<\/span>\/contrib\/inventory\/ec2.ini\nchmod +x ~<span class=\"hljs-regexp\">\/my_aws_project\/inventory<\/span><span class=\"hljs-regexp\">\/ec2.py<\/span>\n<\/code><\/pre>\n<p>There are multiple configuration options you can do with the ini file. For this blog I&#8217;ll change those vars:<\/p>\n<pre><code class=\"lang-bash\"><span class=\"hljs-attr\">regions<\/span> = eu-central-<span class=\"hljs-number\">1<\/span>\n<span class=\"hljs-attr\">vpc_destination_variable<\/span> = private_ip_address\n<\/code><\/pre>\n<p>Test the inventory script:<\/p>\n<pre><code class=\"lang-bash\">~\/my_aws_project\/inventory\/ec2.py ## ---&gt; return JSON description <span class=\"hljs-keyword\">of<\/span> your AWS infrastructure\n<\/code><\/pre>\n<p>Because I want to work on one AWS region in the private network only. Since my bastion is already in<br \/>\nthe AWS infrastructure.<\/p>\n<h2 id=\"add-a-role-for-our-deployment\">Add a role for our deployment<\/h2>\n<p>I&#8217;ll create a role with the only purpose to deploy my infrastructure into AWS.<\/p>\n<pre><code class=\"lang-bash\">ansible-galaxy <span class=\"hljs-keyword\">init<\/span> --<span class=\"hljs-keyword\">init<\/span>-path ~\/my_aws_project\/roles ec2_instances_dep\n<\/code><\/pre>\n<h2 id=\"cable-the-components-ansible-configuration-\">Cable the components (Ansible configuration)<\/h2>\n<p>To have that layout working fine and the simpliest way, I use that configuration:<\/p>\n<pre><code class=\"lang-bash\"><span class=\"hljs-comment\">## file ~\/my_aws_project\/ansible.cfg<\/span>\n<span class=\"hljs-section\">[defaults]<\/span>\n<span class=\"hljs-attr\">roles_path<\/span> = .\/roles\n<span class=\"hljs-attr\">inventory<\/span>  = .\/inventory\/ec2.py\n<\/code><\/pre>\n<p>Test the ansible inventory:<\/p>\n<pre><code class=\"lang-bash\"><span class=\"hljs-built_in\">cd<\/span> ~\/my_aws_project\nansible-inventory --graph <span class=\"hljs-comment\">## ---&gt; return the Ansible interpreted inventory<\/span>\n<\/code><\/pre>\n<h2 id=\"terraform-with-ansible\">Terraform with Ansible<\/h2>\n<p>When I need to do something with Ansible, I first check in the <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/modules\/list_of_all_modules.html\">list of modules<\/a> is the work is already done.<br \/>\nAnd, nicely, there is a <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/modules\/terraform_module.html#terraform-module\">module for Terraform<\/a>.<\/p>\n<p>So I can add this module in my task main file of my role:<\/p>\n<pre><code class=\"lang-bash\"><span class=\"hljs-comment\">## ~\/my_aws_project\/roles\/ec2_instances_dep\/tasks\/main.yml<\/span>\n<span class=\"hljs-meta\">---<\/span>\n<span class=\"hljs-attr\">- name:<\/span> I create a directory to store my Terraform config\n<span class=\"hljs-attr\">  file:<\/span>\n<span class=\"hljs-attr\">    path:<\/span> <span class=\"hljs-string\">\"~\/aws_terraform\"<\/span>\n<span class=\"hljs-attr\">    state:<\/span> directory\n<span class=\"hljs-attr\">    recurse:<\/span> <span class=\"hljs-literal\">yes<\/span>\n\n<span class=\"hljs-attr\">- name:<\/span> I copy my Terraform template into the working directory create above\n<span class=\"hljs-attr\">  template:<\/span>\n<span class=\"hljs-attr\">    src:<\/span> <span class=\"hljs-string\">\"my_ec2_infra.tf\"<\/span>\n<span class=\"hljs-attr\">    dest:<\/span> <span class=\"hljs-string\">\"~\/aws_terraform\/my_ec2_infra.tf\"<\/span>\n\n<span class=\"hljs-attr\">- name:<\/span> I deploy my configuration into AWS from Ansible\n<span class=\"hljs-attr\">  terraform:<\/span>\n<span class=\"hljs-attr\">    project_path:<\/span> <span class=\"hljs-string\">\"~\/aws_terraform\"<\/span>\n<span class=\"hljs-attr\">    force_init:<\/span> <span class=\"hljs-literal\">true<\/span>\n<span class=\"hljs-attr\">    state:<\/span> <span class=\"hljs-string\">\"present\"<\/span>\n<span class=\"hljs-attr\">  register:<\/span> r_aws\n\n<span class=\"hljs-attr\">- name:<\/span> I do whatever I need to do in my EC2 infrastructure\n<span class=\"hljs-attr\">  debug:<\/span> msg=<span class=\"hljs-string\">\"update, install, create user, start services, etc\"<\/span>\n\n<span class=\"hljs-attr\">- name:<\/span> I destroy my AWS infrastructure \n<span class=\"hljs-attr\">  terraform:<\/span>\n<span class=\"hljs-attr\">    project_path:<\/span> <span class=\"hljs-string\">\"~\/aws_terraform\"<\/span>\n<span class=\"hljs-attr\">    state:<\/span> <span class=\"hljs-string\">\"absent\"<\/span>\n<\/code><\/pre>\n<h2 id=\"terraform-content\">Terraform content<\/h2>\n<p>Add this file into the template directory: ~\/my_aws_project\/roles\/ec2_instances_dep<\/p>\n<pre><code class=\"lang-bash\"><span class=\"hljs-comment\">## file ~\/my_aws_project\/roles\/ec2_instances_dep\/my_ec2_infra.tf<\/span>\nprovider <span class=\"hljs-string\">\"aws\"<\/span> {\n  <span class=\"hljs-attr\">region<\/span> = <span class=\"hljs-string\">\"eu-central-1\"<\/span>\n}\n\nresource <span class=\"hljs-string\">\"aws_instance\"<\/span> <span class=\"hljs-string\">\"dba-essential\"<\/span> {\n  <span class=\"hljs-attr\">count<\/span>                       = <span class=\"hljs-string\">\"5\"<\/span>\n  <span class=\"hljs-attr\">ami<\/span>                         = <span class=\"hljs-string\">\"ami-0e342d72b12109f91\"<\/span>\n  <span class=\"hljs-attr\">availability_zone<\/span>           = <span class=\"hljs-string\">\"eu-central-1a\"<\/span>\n  <span class=\"hljs-attr\">instance_type<\/span>               = <span class=\"hljs-string\">\"t2.micro\"<\/span>\n  <span class=\"hljs-attr\">associate_public_ip_address<\/span> = <span class=\"hljs-literal\">false<\/span>\n  <span class=\"hljs-attr\">security_groups<\/span>             = [<span class=\"hljs-string\">\"my_sg_01\"<\/span>]\n  <span class=\"hljs-attr\">vpc_security_group_ids<\/span>      = [<span class=\"hljs-string\">\"sg-602eff2724d52a0b7\"<\/span>]\n  <span class=\"hljs-attr\">key_name<\/span>                    = <span class=\"hljs-string\">\"my_key_01\"<\/span>\n\n  root_block_device {\n    <span class=\"hljs-attr\">delete_on_termination<\/span> = <span class=\"hljs-literal\">true<\/span>\n    <span class=\"hljs-attr\">encrypted<\/span>             = <span class=\"hljs-literal\">false<\/span>\n    <span class=\"hljs-attr\">volume_size<\/span>           = <span class=\"hljs-number\">15<\/span>\n    <span class=\"hljs-attr\">volume_type<\/span>           = <span class=\"hljs-string\">\"gp2\"<\/span>\n  }\n\n  <span class=\"hljs-attr\">tags<\/span> = {\n    <span class=\"hljs-attr\">Owner<\/span>           = <span class=\"hljs-string\">\"Nicolas\"<\/span>\n    <span class=\"hljs-attr\">Name<\/span>            = <span class=\"hljs-string\">\"crash-test-<span class=\"hljs-subst\">${count.index + <span class=\"hljs-number\">1<\/span>}<\/span>\"<\/span>\n  }\n\n}\n<\/code><\/pre>\n<h2 id=\"create-a-playbook-to-call-the-role\">Create a playbook to call the role<\/h2>\n<pre><code class=\"lang-bash\"><span class=\"hljs-comment\">## file ~\/my_aws_project\/playbooks\/deploy.yml<\/span>\n<span class=\"hljs-meta\">---<\/span>\n<span class=\"hljs-attr\">- name:<\/span> Deploy my infrastructure\n<span class=\"hljs-attr\">  hosts:<\/span> localhost\n<span class=\"hljs-attr\">  roles:<\/span>\n\n<span class=\"hljs-bullet\">    -<\/span> ec2_instances_dep\n<\/code><\/pre>\n<h2 id=\"run-the-playbook\">Run the playbook<\/h2>\n<pre><code class=\"lang-bash\"><span class=\"hljs-built_in\">cd<\/span> my_aws_project\nansible-playbook playbooks\/deploy.yml\n<\/code><\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-40082\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg\" alt=\"\" width=\"1024\" height=\"438\" \/><\/a>Boom! Here it is. Now imagine that you can generate a unique key and unique directory for each deployment and you can deploy as much infrastructure as your credit card will accept it.<\/p>\n<p>I hope this helps, and please comment below for any questions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Automate AWS deployments with Ansible + Terraform This installation is made from a bastion server already available with the proper network permissions. For different deployment types, you should adapt it to your need. Install requirements Ansible installation: sudo apt update sudo apt install -y software-properties-common sudo apt-add-repository &#8211;yes &#8211;update ppa:ansible\/ansible sudo apt install -y ansible&hellip;&nbsp;<\/p>\n","protected":false},"author":27,"featured_media":14196,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[955],"tags":[],"class_list":["post-14195","post","type-post","status-publish","format-standard","has-post-thumbnail","category-cloud"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Automate AWS deployments with Ansible + Terraform - dbi services Blog<\/title>\n<meta name=\"description\" content=\"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automate AWS deployments with Ansible + Terraform\" \/>\n<meta property=\"og:description\" content=\"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-26T04:40:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1164\" \/>\n\t<meta property=\"og:image:height\" content=\"498\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\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:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bf7c7eb0bec165183207237c9d0ee1d5\"},\"headline\":\"Automate AWS deployments with Ansible + Terraform\",\"datePublished\":\"2020-05-26T04:40:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/\"},\"wordCount\":425,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible_aws.jpg\",\"articleSection\":[\"Cloud\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/\",\"name\":\"Automate AWS deployments with Ansible + Terraform - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible_aws.jpg\",\"datePublished\":\"2020-05-26T04:40:53+00:00\",\"description\":\"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible_aws.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/ansible_aws.jpg\",\"width\":1164,\"height\":498},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/automate-aws-deployment-with-ansible-terraform\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automate AWS deployments with Ansible + Terraform\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bf7c7eb0bec165183207237c9d0ee1d5\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/oracle-square.png\",\"caption\":\"Oracle Team\"},\"description\":\"Posts published under the Oracle Team account are collective contributions by the dbi services Oracle consultants. The practice covers the full Oracle Database lifecycle: architecture, migration and upgrade, high availability with RAC and Data Guard, backup and recovery, performance tuning, and engineered systems such as Oracle Database Appliance and Exadata. The team holds Oracle certifications up to Certified Master level and operates customer platforms under service level agreements.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/oracle-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Automate AWS deployments with Ansible + Terraform - dbi services Blog","description":"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.","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:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/","og_locale":"en_US","og_type":"article","og_title":"Automate AWS deployments with Ansible + Terraform","og_description":"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.","og_url":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2020-05-26T04:40:53+00:00","og_image":[{"width":1164,"height":498,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg","type":"image\/jpeg"}],"author":"Oracle Team","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bf7c7eb0bec165183207237c9d0ee1d5"},"headline":"Automate AWS deployments with Ansible + Terraform","datePublished":"2020-05-26T04:40:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/"},"wordCount":425,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg","articleSection":["Cloud"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/","url":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/","name":"Automate AWS deployments with Ansible + Terraform - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg","datePublished":"2020-05-26T04:40:53+00:00","description":"How to automate AWS deployment with Ansible + Terraform? Learn how to combine both tools to decuple your productivity here.","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/ansible_aws.jpg","width":1164,"height":498},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/automate-aws-deployment-with-ansible-terraform\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Automate AWS deployments with Ansible + Terraform"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bf7c7eb0bec165183207237c9d0ee1d5","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/12\/oracle-square.png","caption":"Oracle Team"},"description":"Posts published under the Oracle Team account are collective contributions by the dbi services Oracle consultants. The practice covers the full Oracle Database lifecycle: architecture, migration and upgrade, high availability with RAC and Data Guard, backup and recovery, performance tuning, and engineered systems such as Oracle Database Appliance and Exadata. The team holds Oracle certifications up to Certified Master level and operates customer platforms under service level agreements.","url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=14195"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/14195\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/14196"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=14195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=14195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=14195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}