1
votes

I'm running a .net server on Amazon's Elastic Beanstalk and when I try to instantiate AmazonDynamoDBClient it fails. According to the information I've been following from these two pages: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.iam.roles.apps.html http://docs.aws.amazon.com/AWSSdkDocsNET/latest/DeveloperGuide/net-dg-roles.html It should retrieve the credentials from the IAM role assigned to the EC2 instance. It has the DynamoDBFullAccess template as a policy. If I supply the credentials in the code itself through the web.config file it works, but only when debugging locally and not when deployed to elastic beanstalk.

Here is the code that breaks it:

AmazonDynamoDBClient client = new AmazonDynamoDBClient();

or

AmazonDynamoDBClient client = new AmazonDynamoDBClient(new InstanceProfileAWSCredentials());

Neither works. And I can't seem to retrieve crash logs from elastic beanstalk, so it is hard to debug. I'm pretty sure that I'm following the descriptions in those two links to the letter and am confused. I've been trying to solve this for the better part of a day and would really appreciate some help. If there is any information missing, please let me know. Thank you.

1
Does the following procedure work for you when trying to snapshot logs: docs.aws.amazon.com/elasticbeanstalk/latest/dg/… If not what error do you get when trying to snapshot logs? - Rohit Banga

1 Answers

1
votes

If you go to aws console and select ec2 view instances you will see the ec2 instance for your elastic beanstalk. The name of that instance will be either "Default-Environment" or whatever name you chose for your elastic beanstalk environment. Then you can ssh to that ec2 instance and view logs. For example my tomcat logs are stored at /var/log/tomcat7

You can also scp your credential file to your ec2 host just for debug and run the app. It should work because you already have it working on your local machine. but I guess this approach is not recommended and may has security concern.

This should at least get you started. may be an EC2 expert can help you solve the real problem :)