{"id":17,"date":"2022-03-20T10:42:00","date_gmt":"2022-03-20T15:42:00","guid":{"rendered":"https:\/\/34.82.124.6\/?p=17"},"modified":"2022-07-31T08:24:11","modified_gmt":"2022-07-31T13:24:11","slug":"add-permanent-environment-variables","status":"publish","type":"post","link":"https:\/\/cloudlearning365.com\/?p=17","title":{"rendered":"Add permanent environment variables"},"content":{"rendered":"\n<p>When you are using terraform or some other tools requiring environment variables, you may find the environment variables doesn\u2019t stay between sessions.<\/p>\n\n\n\n<p>Here\u2019s how I took care of it:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Windows<\/h2>\n\n\n\n<p>This is rather easy, just go to&nbsp;<strong>System Properties<\/strong>&nbsp;by running&nbsp;<strong>sysdm.cpl<\/strong>&nbsp;in command line, then click on&nbsp;<strong>Environment Variables<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cloudlearning365.com\/wp-content\/uploads\/2022\/03\/image-6.png\" alt=\"\" class=\"wp-image-30\" \/><\/figure>\n\n\n\n<p>Add or edit existing environment variables, such as&nbsp;<strong>AWS_ACCESS_KEY_ID<\/strong>&nbsp;or&nbsp;<strong>AWS_SECRET_ACCESS_KEY<\/strong>, the settings will take effect next time when you launch your command prompt or PowerShell session<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/cloudlearning365.com\/wp-content\/uploads\/2022\/03\/image-7.png\" alt=\"\" class=\"wp-image-31\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Linux \/ Mac<\/h2>\n\n\n\n<p>First you have to find out what shell you are using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ echo $SHELL<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>If it returns: \/bin\/bash, then you are using bash, and need to edit ~\/.bashrc<\/li><li>If it returns: \/bin\/zsh, then you are using zsh, and need to edit ~\/.zshrc<\/li><\/ul>\n\n\n\n<p>Example of <strong>~\/.bashrc<\/strong> file. Make sure to place\u00a0<strong>export\u00a0<\/strong>in front of each line, and there should be <strong>no whitespace<\/strong> around equal sign = <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cat ~\/.bashrc\n\n# environment variables\nexport AVIATRIX_CONTROLLER_IP='****'\nexport AVIATRIX_PASSWORD='****'\nexport AVIATRIX_USERNAME='****'\nexport AWS_ACCESS_KEY_ID='****'\nexport AWS_SECRET_ACCESS_KEY='****'\nexport GOOGLE_APPLICATION_CREDENTIALS='****'<\/code><\/pre>\n\n\n\n<p>Next time when you launch console session, these settings will take effect<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you are using terraform or some other tools requiring environment variables, you may find the environment variables doesn\u2019t stay between sessions. Here\u2019s how I took care of it: Windows This is rather easy, just go to&nbsp;System Properties&nbsp;by running&nbsp;sysdm.cpl&nbsp;in command &hellip; <a href=\"https:\/\/cloudlearning365.com\/?p=17\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-terraform"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":3,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":343,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/343"}],"wp:attachment":[{"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudlearning365.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}