Trying to deploy Streamlit to AWS EC2, connection successful, local instance perfectly functional, but EC2 instance throws the following exception - machine-learning

Streamlit API on EC2 instance
Restarted the instance and added force_reload=True to model loader
Streamlit - https://github.com/CG4aiml/Streamlit

Related

Getting error when calling Aurora Serverless cluster locally in container using koxudaxi/local-data-api

When calling Data-API to a container instance using koxudaxi/local-data-api I am getting error:
code:'BadRequestException'
message:'Error: cluster arn:aws:rds:us-east-1:123456789012:cluster:dummy does not belong to the calling account id 'my_sso_account_id'
name:'BadRequestException'
Calling the Data-API to the cluster in AWS works fine when using correct arn and secret, it's only failing when calling the local container instance.

Unable to connect to AWS RDS instance from docker container

On my Windows 10 host machine I am able to connect to a private SQL Server RDS instance running in AWS. However, a Docker container running locally on the same machine is unable to connect with the same connection string.
From the Docker container I am able to telnet to the server on 1433 successfully. However, when I connect from code, it seems to be unable to create a connection. No exception is thrown, but this code hangs:
using (var conn = new SqlConnection(connectionString)){
// Do something
}
I am able to successfully connect to SQL Server when it is running on a EC2 instance. It appears to be specific to RDS.
Fails with both the name and IP address.
This was caused by a bug in SQLClient as described on GitHub. There were two fixes that worked:
Downgrade the project from Net Core 3.1 to 2.2
Update Docker file to use aspnet:3.1-bionic instead of aspnet:3.1-buster-slim and sdk:3.1-bionic instead of sdk:3.1-buster

Elastic Beanstalk Environment for multi-container docker fails to be created due to LaunchWaitCondition

I'm gonna set up sample elasticbeanstalk environment for multi-container docker.
But it is not created due to error.
environment tier: web-server
other configuration info: https://i.stack.imgur.com/gKwBn.png
I want to create sample elasticbeanstalk environment for multi-container docker.
But the actual is not created.
Here is the error statement.
WARN Environment health has transitioned from Pending to Severe.
Initialization in progress (running for 15 minutes). None of the instances are sending data.
ERROR Stack named 'awseb-e-at4dw9xg2u-stack' aborted operation.
Current state: 'CREATE_FAILED' Reason: The following resource(s) failed to create: [AWSEBInstanceLaunchWaitCondition].
ERROR LaunchWaitCondition failed.
The expected number of EC2 instances were not initialized within the given time.
Rebuild the environment. If this persists, contact support.
This issue is solved by allowing inbound & outbound traffic for default ACL network.
inbound
outbound

Rails - Net::SSH::AuthenticationFailed from EC2 instance to external Database

I'm connecting from a Rails App to an external database using
Net::SSH::Gateway.new('hostname', 'username') in order to create a tunnel for the localhost.
If I run the app locally, I can connect perfectly and access the external database, but when I do it on a EC2 instance, I get an Net::SSH::AuthenticationFailedon that same line.
The weird part is that if I log into my EC2 instance through ssh and then I access the external server through ssh in the EC2 console, I can successfully connect. What could it be that I can't connect through the rails app?

After upgrading from micro to small Amazon EC2 instance, I cannot deploy any new code

I upgraded from micro instance to small instance on Amazon EC2.
When I wanted to deploy a new code, the code was not deployed due to
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: ELASTIC_IP (Errno::ETIMEDOUT: Operation timed out - connect(2))
connection failed for: ELASTIC_IP (Errno::ETIMEDOUT: Operation timed out - connect(2))
So it looks like the upgrade ignore the old elastic IP. Thus, I created a new Elastic IP and assigned this IP to the new instance and this error gone.
But when I access www.my_project.com, or 11.22.33.44 (elastic IP) or the Public DNS (ec2-11-222-333-444.compute-1.amazonaws.com), there is still an empty page and not my application.
The code is deployed via Capistrano without any error. On the old micro instance I used nginx - is this nginx accessible also on the new instance or do I need to set up/install again?
How to make my app accessible?
Thank you
If I had to guess, it's that the SSH key (not the EC2 key pair, but the actual SSH key coming from the machine) has changed, and by default, SSH on your local machine will block the connection for security reasons.
If you have a Mac/Linux machine you're using, you can look inside ~/.ssh/known_hosts and remove the entry for your Elastic IP, save the changes, and try to SSH into the machine again to confirm the connection.
Not sure of the right path in Windows, but you'd make the same changes.
Aws needs manual monitoring when you end up with issues like this.
While you were upgrading your instance, what was the approach you took?
Either you
create an ami with instance and volumes and then launch the ami with fresh small instance or
Detach the ebs volume and attach to a small instance and made required configuration changes.
ssh into the instance and check for
If you could manually deploy the code.
If it's a git repo, you can pull and push changes directly.
All the processes related to nginx,db etc are running.
Where does the default home page for instance lands to . for ex documentroot in case of apache.conf.
I cannot rule out the possibility of key mismatch still the error doesn't points to that.

Resources