I am having trouble executing awscli within a tomcat web application. I would appreciate a lot if anyone could help me with this problem. Here is what I am doing.
I am using an EC2 ubuntu instance and have deployed a web application on it(using tomcat7 and apache2). On a button click in the web page, I call a service in my application which will try to execute an external program (i.e. bash script) through Java's ProcessBuilder().
The problem here is that, bash script runs properly but any of the awscli commands do not execute(for eg: aws ec2 describe-tags). This is what I see in the "catalina.out" file -->
Unable to locate credentials. You can configure credentials by running "aws configure".
FYI, aws is configured properly (I run aws configure as user "ubuntu"). When I manually execute "aws ec2 describe-tags" on command line or manually execute the bash script it works fine. I understand that this is something to do with user permissions(I believe, user "tomcat7" unable to access aws credentials). I have tried several ways to get rid of this error but none of them were useful. Here is the list of what I have tried until now.
- Adding "tomcat7" to groups sudo and ubuntu
- setting AWS_CONFIG_FILE=/home/ubutu/.aws/config
- setting environment variables like AWS_ACCESS_KEY_ID, etc., etc. directly in bash script file
Here is additional information if required:
aws --version aws-cli/1.2.9 Python/3.4.0 Linux/3.13.0-48-generic
Aucun commentaire:
Enregistrer un commentaire