Is there a way to set the path other than %USERPROFILE% for aws configure?
I cannot explain why, but on Windows 10 after aws configure runs, it automatically creates the following path and files:
C:\Users\myusername\%USERPROFILE%\Documents.aws
Note the userprofile folder is actually named that way. It's not the windows environment folder.
Normally its supposed to create C:\users\myusername.aws etc.
No, apart from %USERPROFILE there is no other way for aws configure
aws cli configure code
def _write_out_creds_file_values(self, new_values, profile_name):
# The access_key/secret_key are now *always* written to the shared
# credentials file (~/.aws/credentials), see aws/aws-cli#847.
# post-conditions: ~/.aws/credentials will have the updated credential
# file values and new_values will have the cred vars removed.
credential_file_values = {}
Where are configuration settings stored?
Home directory is referred to using the environment variables %UserProfile% in Windows and $HOME or ~ (tilde) in Unix-based systems.
But there is something more to it:
As a general rule, any value that you can place in the credentials file can alternatively be placed in the config file. The other way isn't true: only a few settings can be placed in the credentials file.
So you can place credentials in .aws/config file,and for there is an environment variable named AWS_CONFIG_FILE you can pass and it will be written there. Even though it is not recommended to place credentials in config file
Related
AWS stores the default configuration files in ~/.aws/.
I'm trying to have all hidden directories inside ~/.config/, and would like to change the default location to ~/.config/aws/
How would I do this from the AWS CLI?
You can specify a non-default location for the config file by setting the AWS_CONFIG_FILE environment variable to another local path.
Steps I used:
1. Create a folder with the name of your choice. I used .awscheck (mkdir .awscheck)
2. Create a file named credentials within the folder.
3. Configure the variable. (export AWS_CONFIG_FILE=~/.awscheck/credentials)
4. Run aws configure and add your values.
Similarly, if you want to store configurations, you can create a config file and add the configurations like profiles and regions in the config file.
Custom locations for config and credentials files can be specified using two environment variables:
AWS_CONFIG_FILE: Specifies the location of the file that the AWS CLI uses to store configuration profiles. The default path is ~/.aws/config.
AWS_SHARED_CREDENTIALS_FILE: Specifies the location of the file that the AWS CLI uses to store access keys. The default path is ~/.aws/credentials.
I'm trying to SSH to my EB instance but
eb ssh
eb ssh --setup
Both gives me
ERROR: InvalidProfileError - The config profile (default) could not be found
I did check $HOME/.aws/config which was generate through eb-cli and it does seem to be in the right place with correctly generated credential.
[profile eb-cli]
aws_access_key_id = correctkeyid
aws_secret_access_key = correctaccesskey
I copied config file and threw it in [project]/.aws just to see if it does anything but still the same error as expected.
The eb ssh cli tool is attempting to read back AWS profile entries for a default AWS profile (typically from ~/.aws/config and ~/.aws/credentials files), but the profile contained in these files is a named profile – named as eb-cli, from the line [profile eb-cli].
Option 1) In the project, edit the .elasticbeanstalk/config.yml file
from profile: default
to profile: eb-cli
Option 2) Edit the bracketed names in the those ~/.aws/* files to align with the profile name declared in the config.yml file.
Or update all of these entries to something more meaningful to the project, such as my-project. Once these profile names align, you'll be able to connect with eb ssh.
Note that the ~/.aws/* configuration files support multiple named profile entries, which enables having multiple projects linked to differently named AWS profiles.
I'm trying to move a file located within my app directory:
{MyAppRoot}/.aws_scripts/eb_config.js
to
{MyAppRoot}/config.js.
I need this mv or cp to happen before the app is actually restarted, as this files presence is required immediately by the main app module. I've tried using .ebextensions various mechanisms like commands, container_commands, etc but all fail, with either no stat, or permission denied. I'm unable to get further details from eb_activity.log or any of the other log files. I came across this similar question on the aws forums but I'm not able to achieve any success.
What's the proper way to accomplish this? Thanks.
In commandsyour project specific files are not set up yet.
In container_commands they files are in a temporary staging location, but current path is that staging directory. The following should work:
container_commands:
cp .aws_scripts/eb_config.js config.js.
I am trying to install the Amazon Web Services Python SDK. I cannot find the ~/.aws/credentials folder on my machine though.
This is the page I am using for reference: https://aws.amazon.com/developers/getting-started/python/
It says the location on Windows should be like: C:\Users\USER_NAME.aws\credentials
I've done pip installs for boto, boto3, and awscli. Is there something else I need to install to get a credentials folder?
According to the link you posted...
Create your credentials file at ~/.aws/credentials (C:\Users\USER_NAME.aws\credentials for Windows users) and save the following lines after replacing the underlined values with your own.
With the contents
[default]
aws_access_key_id = YOUR_ACCESS_KEY_ID
aws_secret_access_key = YOUR_SECRET_ACCESS_KEY
There's nothing you need to install, just create the file, and put that in. (obviously swapping out YOUR_ACCESS_KEY_ID for your actual access key, and YOUR_SECRET_ACCESS_KEY for your actual secret key ;) )
I'm trying to add memory usage monitoring to the monitoring tab of an instance at console.aws.amazon.com. It's an instance running Amazon Linux AMI 2013.09.2 I have found the Amazon CloudWatch Monitoring Scripts for Linux and specifically mon-put-instance-data.pl that let's me collect memory stats and report it to CloudWatch as custom metrics.
To have this working I need to set the environment variable AWS_CREDENTIAL_FILE to point to a file containing my AWSAccessKeyId and AWSSecretKey. I do this by typing:
export AWS_CREDENTIAL_FILE=/home/ec2-user/aws-scripts-mon/awscreds.template
To avoid having to type this over and over again, I'm looking for a way to set the environment variable at startup. I have tried adding the code to these files:
/etc/rc.local file
/etc/profile
/home/ec2-user/.bash_profile
As adding the line of code in either of the files seems to work when I switch to root user, where should I put it? If I set the variable in /home/ec2-user/.bash_profile the variable is set for ec2-user but not for root. If i then sudo -E su it works, but I don't know if this is the best way to go about it?
Create a sh file and put the code in it. Then put this sh file in /etc/profile.d/ folder.
Note: create this sh file using the root user.
Once your instance is created, this sh file will automatically run and creates the environment variable for you and this environment variable will be accessible to all the users.