Cannot Pull Container Error in Amazon Elastic Container Service - amazon-web-services

I am trying to launch a task in Amazon ECS but getting the following error:
CannotPullContainerError: Error response from daemon, request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
I was able to pull container in my local environment and it works fine but getting this error while trying to deploy in amazon environment.

The suggested checks from Amazon are as follows:
Confirm that the subnet used to run a task has a route to an internet gateway or NAT gateway in a route table.
Note: Instead of an internet gateway or NAT gateway, you can use AWS PrivateLink. To avoid errors, be sure to correctly configure AWS PrivateLink or HTTP proxy.
If you're launching tasks in a public subnet, choose ENABLED for Auto-assign public IP when you launch a task in the Amazon EC2 console. This allows your task to have outbound network access to pull an image.
If you're using an Amazon provided DNS in your Amazon VPC, confirm that the security group attached to the instance has outbound access allowed for HTTPS (port 443).
If you're using a custom DNS, confirm that outbound access is allowed for DNS (UDP and TCP) on port 53 and HTTPS access on port 443.
Verify that your network ACL rules aren't blocking traffic to the registry.
This error ultimately points to a network connectivity issue between the subnet or MicroVM your container runs on and the ECS service.
By default it will traverse the public internet (unless you have setup the correct VPC endpoints). So if you do not have outbound internet support you will not be able to connect to the ECR endpoint.

Related

AWS EventBridge API Destination can't connect to EC2 private IP

My goal is to forward messages from EventBridge over HTTPS to an instance in EC2 running httpd server. The instance only has its private IP.
It turned out that the EventBridge's API Destination with its Targets and Connections works beautifully with external IPs, but no communication is happening to the Private IP. As part of the experiment Security is set to accept all https/http connections from all 0.0.0.0/0.
I am seriously considering EventBridge -> Lambda function with VPC bind -> EC2 Private IP.
But I am having that nagging feel that I maybe missing something with the API Destination, some network magic? An endpoint?
Any advice is welcome!
EventBridge over HTTPS to an instance in EC2 running httpd server. The instance only has its private IP.
You can't do this. HTTPS requires valid public domain with valid public SSL certificate. This in turn requires your instance to be accessible from the internet.
The instance itself can be private only, but in that case you have to front it with internet facing ALB, which will handle HTTPS for you.

AWS managed service unable to resolve DNS via Route53

We have defined Route53 Resolver Rule with an Resolver Outbound Endpoint that forwards requests to our on-prem DNS servers, and it works fine from within EC2 instances, I can confirm that from an ssh session nslookup, however, MSK Connect connector that is referencing a schema registry URL throws UnknownHostException being unable to resolve DNS. I checked security group outbound rules for MSK and they allow all traffic, and our network admin actually see requests coming and responding at about the time when MSK connect logs the error. What can obstruct MSK to receive response?

ActiveMQ Artemis configuration in AWS problem

I am trying to connect an ActiveMQ Artemis broker on a publicly accessible server outside of the AWS cloud to an Artemis broker in AWS.
The AWS side has a Route 53 entry and a classic load balancer to route the incoming request to Artemis running on an EC2 instance. Both brokers are using a CORE bridge to connect with each other. I am using the Netty SSL protocol and trying to use certificates.
Neither side is able to connect its "bridge" to the other. Using the nice Route 53 name I am able to ping that from the public server outside of AWS. Artemis is not able to connect from the AWS EC2 to the public instance - not sure if that is also related to the NAT or Internet gateway on my VPC. But, the NAT and IGW look correct and AWS security groups look correct.
Questions:
Would Route53 and a classic ELB work to route message requests to Artemis?
What values should be used as the IP/server name and port in the Connector and Acceptor?
Has anyone done this? I find no other references out there.
Yes, I know of "AWS ActiveMQ" service. That is a backup plan.
Any help is greatly appreciated.

AWS NLB warning: There is an Internet Gateway attached to these subnets

I am relatively new to AWS. I've been able to:
Setup edge-optimized API Gateway endpoints (w/a custom domain ... install an SSL cert, etc.)
Route requests from API Gateway to a server running on an EC2 instance via HTTP proxy
For learning, I'd like to put a Network Load Balancer (NLB) between API Gateway and the EC2 instance. After that, I want to experiment with Auto-Scaling Groups (in order to see how EC2 instances can be scaled out/in).
BUT I'm stuck on the NLB. After adding it in, requests made to API Gateway endpoints simply return internal server error.
Question
Should I be using an internal or internet-facing NLB to route the requests from API Gateway to the EC2 instances?
When I opt to use an internal NLB, I get a warning message You are creating an internal Load Balancer, but there is an Internet Gateway attached to these subnets ... and then I run into the internal server error problem.
When I setup an internet-facing NLB, API Gateway warns me something to the effect of, "Your NLB is already public-facing, so the use of a VPC Link might be unnecessary".
Can someone shed some light on what I should be doing?
I was able to create a NLB in a private subnet and create a VPC link. Private Subnets use network address translation (NAT) gateways, not internet gatways.
Link: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
NLB
VPCLink

Connect Cloudformation configurated beanstalk setup to an existing AWS site-to-site VPN?

I have this current Cloudformation config setup:
PasteBin example here
This runs a web app, there's also some networking config in there which routes outbound traffic through a nat gateway with an elastic ip.
--
Separately we have a manually created site-to-site VPN setup in AWS
screenshot, elastic ip created by cloudformation :
The other side of the VPN specified that our private ip range for the connection to work has to be in 192.168.242.0/24.
Also they have specifically whitelisted 192.168.242.230 at their end. Which is the private ip of the elasticip which the Cloudformation above created.
How can I establish a connection from my EBS ec2 instance to a server protected by this VPN? At the moment the connection just times out.
You would need to add a route table rule to allow traffic to X.X.X.X/X flow via the Virtual Private Gateway(vgw-xxxxxx)
Destination Target
x.x.x.x/x vgw-xxxxxx