Already looked for a solution but nothing seems to be helpfull, I'm doing everything that is meant to be made and my instance keeps returning me the message "Server refused our key".
Here's what I've been doing:
1) Create Instance;
2) Download the .pem key;
3) PuttyGen to transform it in a private .ppk (SSH-2 RSA);
4) Associate an Elastic IP to the Instance;
5) Connect through 22 with the correct auth key generated on the 3rd step;
6) Server asks for username, insert "ubuntu" (using 12.04.1 LTS);
7) Server returns "Server refused our key".
Tried to reboot a hundred times, tried SSH-1 RSA, tried public key instead of private key, tried keys with passphrase, tried everything.
Someone else is experiencing this?
Edit:
Thought it might be a security problem, here are my rules if that helps:
http://i.stack.imgur.com/Y3I2s.png
Just got into the same issue. AWS instance recognize only the key which was specified during the instance creation. All later changes to the key list will not affect already created instance.
Edit: actually, here problem was in incorrect export to .ppk file using Puttygen. See comments below.
Related
I've been getting an amazon instance ID from within the instance itself for over a year now by hitting this local web address http://169.254.169.254/latest/meta-data/instance-id. This is the appropriate method according to the AWS documentation. For some reason though, just this week that same call started throwing an error.
I tried pinging the 169.254.169.254 address from the command line and that fails, so it seems like something pretty basic has changed with the EC2 instances. I don't see any changes to the documentation on AWS. One thing I do notice is that I used to see the instance name in the upper right hand corner when loading up the instance and logging in remotely. That information doesn't appear anymore.
Here is the code I've been using to get the ID:
retID = New StreamReader(HttpWebRequest.Create("http://169.254.169.254/latest/meta-data/instance-id").GetResponse().GetResponseStream()).ReadToEnd()
Here is the full error stack:
at System.Net.HttpWebRequest.GetResponse()
at RunControllerInterface.NewRunControlCommunicate.getInstanceIDFromAmazon()
The error message itself says: Unable to connect to the remote server
Any help would be appreciated.
So I think I have at least a partial answer to this problem. When making this image, I was using a t3a.medium instance. As long as I use that same type of instance I am able to pull down the instance name.
I am developing an ASP.NET Core Web API project. In my project, I am using Hangfire to run the background task. Therefore, I am configuring the Hangfire to use the database like this.
public void ConfigureServices(IServiceCollection services)
{
services.AddHangfire(configuration =>
{
configuration.UseSqlServerStorage("Server=(LocalDB)\\MSSQLLocalDB;Integrated Security=true;");
});
//
}
In the above code, I am using Local DB. Now, I am trying to use AWS RDS database since I am deploying my application on the AWS Elastic Beanstalks. I created a function for getting the connection
public static string GetRDSConnectionString()
{
string dbname = "ebdb";
if(string.IsNullOrEmpty(dbname)) return null;
string username = "admin";
string password = "password";
string hostname = "cxcxcxcx.xcxcxcxc.eu-west-2.rds.amazonaws.com:1234";
string port = "1234";
return "Data Source=" + hostname + ";Initial Catalog=" + dbname + ";User ID=" + username + ";Password=" + password + ";";
}
I got the above code from the official AWS documentation. In the above code, what I am not clear is the database name, is the database name always be "ebdb"? I tried to find out the database name. But could not. In the tutorial, it is saying to use ebdb. So, I used it.
Then in configuration, I changed to this.
configuration.UseSqlServerStorage(AppConfig.GetRDSConnectionString());
When I run the code, it is giving me this error.
Win32Exception: The parameter is incorrect
Unknown location
SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, object providerInfo, bool redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, bool applyTransientFaultHandling)
Win32Exception: The parameter is incorrect
Basically, it cannot connect to the database when I run my application. But I set the correct credentials. the only thing I double is the database name (ebdb). What is wrong with my configuration and what is wrong? How can I fix it?
Calling a few things out here just incase...
You have your port specified both in your host variable and as a separate port variable...but never use port.
Can you confirm that you are able to access your SQLServer via another means, such as from SQL Management Studio?
RDS uses SSL by default now for connections, my .NET is rusty but would you need to inform the connection string that it needs to run over a secure protocol?
& finally, regarding the AWS Security Group on your RDS instance. Have you opened up the correct port to your machine/network/IP?
This is the screenshot of the RDS db instance security group section in the console.
How have I written the code
createPool is used at the start of the app
then for every request I am using getConnection
I am using AWS RDS & it went into sudden recovery mode, due to which my db url was unchanged but instance IP must have changed as it was created in another AZ
So for such a scenario I am supposed to reinitialize my db connection so that new instance DNS is updated.
The issue is in such a scenario I did not received any timeout error or connection error. So how do I capture this type of error?
Kindly guide if possible.
Thanks
It is unclear from your description what exactly you have built, but it sounds like you've created a connection pool.
If you open a connection to the db, the first time you call getConnection you should validate that the connection is still active - obviously if the db fails over, the existing connection will get closed, and you will either need to create a new connection or re-open the existing one.
have a nice day!
How can i get SSH connection without password(root)?
i tried to using 'ssh-keygen'! but it dosen't work!
I registered hostname each servers.
and i copied a point of departure's 'id_dsa.pub' to destination's 'authorized_keys', but i received "Permission denied (publickey)" message
what was worse is that, i copied a point of departure's 'id_dsa.pub' to point of departure's 'authorized_keys" but it dosen't work....
I wonder that is it a AWS EC2 Policy? or just i stupid.
plz help me
I have an issue with correctly failing over to the mirror database. When I am connected to the principal database (dbx) (mirroring is enabled and set up) and I fail over the principal database (shutting down SQL Server to simulate a crash), I can no longer send queries without a failure. This is expected since the previous connection is now lost.
I would like to simply close out my connections and handles and re-establish a new connection, using the same connection string, and re-connect to the mirror database (dby, which is now the principal database).
My connection string is as follows:
Driver={SQL Native Client};Server=dbx;Failover_Partner=dby;Database=db;Uid=uid;Pwd=pwd;Network=DBMSSOCN;
From doing research, I have learned that the Failover_Partner parameter in the connection is almost worthless. It is only used when the principal server is down and a new connection is being made for the first time. For some reason, the Failover_Partner is overwritten internally when a connection is established to the principal and the mirroring_partner_instance found in the sys.database_mirroring table is used instead. So when I specify the Failover_Partner to be dby, after I establish a connection, I query for what it thinks the failover partner is, and it returns the INSTANCE name of the failover partner and not the DNS name (dby).
Here is the issue, I cannot use the INSTANCE name as the failover partner. I am required to use the DNS name as the failover partner.
So my question(s) is/are this:
Is there a way to modify the sys.database_mirroring entry and change the mirroring_partner_instance?
Where does this field get its value from?
Is there any other way to force SQL Server to use the DNS name and NOT the INSTANCE name?
I found the answer to this question in case anyone has the same or a similar issue.
I had to modify the ##SERVERNAME property in SQL. It was internally set to the computer WIN-... instance name and I was able to drop it and add the server name I wanted with the following commands:
Get the current server name (WIN_NAME)
SELECT ##SERVERNAME
Drop the WIN-NAME
SP_DropServer 'WIN_NAME'
GO
SP_AddServer 'SERVER_NAME',local
GO
Restart SQL Server to see the changes take effect.