Link to home
Create AccountLog in
Avatar of Miguel Quintana
Miguel Quintana

asked on

Amazon Web Services: cannot find credentials

Having an error creating a topic on AWS SNS.

I have built the project from VS 2013 then exported the release folder (DLL and TLB files) to a folder in a virtual machine where I have a VB6 project with a reference to the TLB file.

When I debug the project I get this error below...       I hardcoded credentials on the app.config  but this function is still asking for the  "awsSession token" and I don't know how to get it.    

The easiest way seems to be exporting credentials to the Virtual machine, but don't know how to do that

BTW, why the error is retreaving the path of the developing environment??

Exception:

at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous)
   at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials()
   at Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient..ctor()
   at AwsTranscoderNew.ClassConnect.CreateTopic(String emailAddress) in d:\NAC de todo\Amazon\AMAZON DEV2\AwsTranscoderNew\AwsTranscoderNew\ClassConnect.cs:line 177
   at AwsTranscoderNew.ClassConnect.classConnect(String sourceFile, String outputFilename, String email) in d:\NAC de todo\Amazon\AMAZON DEV2\AwsTranscoderNew\AwsTranscoderNew\ClassConnect.cs:line 82



Code:

 
 var snsClient = new AmazonSimpleNotificationServiceClient();   //accessKey, SecretAccess
                var topicArn = snsClient.CreateTopic(new CreateTopicRequest
                {
                    Name = "TranscodeEvents" + UNIQUE_POSTFIX
                }).TopicArn;

                snsClient.Subscribe(new SubscribeRequest
                {
                    TopicArn = topicArn,
                    Protocol = "email",
                    Endpoint = emailAddress
                });

                return topicArn;

Open in new window





App.config


<?xml version="1.0" encoding="utf-8"?>
<configuration>  
  <appSettings>
    <add key="AWSProfileName" value="Developer" />
    <add key="AWSRegion" value="eu-west-1" />
    
    <add key="AWSProfilesLocation" value="C:\aws_service_credentials\credentials"/>

  
    
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <add key="ClientSettingsProvider.ConnectionStringName" value="DefaultConnection" />
  </appSettings>
  <system.web>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientWindowsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" connectionStringName="DefaultConnection" credentialsProvider="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" connectionStringName="DefaultConnection" />
      </providers>
    </roleManager>
  </system.web>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source = |SQL/CE|" />
  </connectionStrings>
</configuration>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Watson
Chris Watson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Miguel Quintana
Miguel Quintana

ASKER

This did the trick  Thx!!

This config file can be embedded into the dll file, right?  so I can hide all the account details after deployment in the production environment?
Hi Miguel,

As far as I know, no, you cannot embed an app.config file. I think you'd have to investigate an alternative if you were concerned about keeping your credentials secure.