Can anyone tell me how/why my Lambda function cannot 'see' a website served by Apache on an EC2 instance when they are both in the same VPC?
My setup:
Amazon Linux v2 Lambda function in the default VPC, same as the one the EC2 instance is on Lambda function using 'default' aka all permissions role to access EC2 instance Apache installed and working correctly on an elastic IP address serving an API and website publically
I know that if I choose to use a Lambda function in the VPC that the internet access is removed, so I can no longer access the website using mydomain.com and that's fine. Long term I will move to a VPC with public and private subnets and configure an internet gateway that the Lambda function can use, but for now I just wonder why I can't use the EC2 hosted website without the internet gateway. Surely the Lambda function should be able to connect to the EC2 website?
I have tried using both the private and public IP address of the EC2 instance and both timeout when trying to connect to Apache.
Any help gratefully received!
Thanks.
P.S. I'm new to AWS so please be kind :)