File size: 2,261 Bytes
f50dbbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
diff --git a/.changes/next-release/enhancement-configure-59283.json b/.changes/next-release/enhancement-configure-59283.json
new file mode 100644
index 000000000000..9392d6e0f5db
--- /dev/null
+++ b/.changes/next-release/enhancement-configure-59283.json
@@ -0,0 +1,5 @@
+{
+  "type": "enhancement",
+  "category": "configure",
+  "description": "Added aws_security_token to the list of keys that are written to the shared credentials file when using aws configure set."
+}
diff --git a/awscli/customizations/configure/set.py b/awscli/customizations/configure/set.py
index 9d4c441ac697..81a0d3d66618 100644
--- a/awscli/customizations/configure/set.py
+++ b/awscli/customizations/configure/set.py
@@ -38,7 +38,7 @@ class ConfigureSetCommand(BasicCommand):
     # Any variables specified in this list will be written to
     # the ~/.aws/credentials file instead of ~/.aws/config.
     _WRITE_TO_CREDS_FILE = ['aws_access_key_id', 'aws_secret_access_key',
-                            'aws_session_token']
+                            'aws_session_token', 'aws_security_token']
 
     def __init__(self, session, config_writer=None):
         super(ConfigureSetCommand, self).__init__(session)
diff --git a/tests/unit/customizations/configure/test_set.py b/tests/unit/customizations/configure/test_set.py
index 27576a7ba8b4..2b8f5c0d7dfe 100644
--- a/tests/unit/customizations/configure/test_set.py
+++ b/tests/unit/customizations/configure/test_set.py
@@ -126,6 +126,15 @@ def test_session_token_written_to_shared_credentials_file(self):
             {'__section__': 'default',
              'aws_session_token': 'foo'}, self.fake_credentials_filename)
 
+    def test_security_token_written_to_shared_credentials_file(self):
+        set_command = ConfigureSetCommand(
+            self.session, self.config_writer)
+        set_command(args=['aws_security_token', 'foo'],
+                    parsed_globals=None)
+        self.config_writer.update_config.assert_called_with(
+            {'__section__': 'default',
+             'aws_security_token': 'foo'}, self.fake_credentials_filename)
+
     def test_access_key_written_to_shared_credentials_file_profile(self):
         set_command = ConfigureSetCommand(
             self.session, self.config_writer)