The problem is having wrong mod on the file.
Easily solved by executing -
chmod 400 mykey.pem
Taken from Amazon's instructions -
Your key file must not be publicly viewable for SSH to work. Use this
command if needed: chmod 400 mykey.pem
400 protects it by making it read only and only for the owner.
SNS is a distributed publish-subscribe system. Messages are pushed to subscribers as and when they are sent by publishers to SNS.
SQS is distributed queuing system. Messages are not pushed to receivers. Receivers have to poll or pull messages from SQS. Messages can't be received by multiple receivers at the same time. Any one receiver can receive a message, process and delete it. Other receivers do not receive the same message later. Polling inherently introduces some latency in message delivery in SQS unlike SNS where messages are immediately pushed to subscribers. SNS supports several end points such as email, SMS, HTTP end point and SQS. If you want unknown number and type of subscribers to receive messages, you need SNS.
You don't have to couple SNS and SQS always. You can have SNS send messages to email, SMS or HTTP end point apart from SQS. There are advantages to coupling SNS with SQS. You may not want an external service to make connections to your hosts (a firewall may block all incoming connections to your host from outside).
Your end point may just die because of heavy volume of messages. Email and SMS maybe not your choice of processing messages quickly. By coupling SNS with SQS, you can receive messages at your pace. It allows clients to be offline, tolerant to network and host failures. You also achieve guaranteed delivery. If you configure SNS to send messages to an HTTP end point or email or SMS, several failures to send message may result in messages being dropped.
SQS is mainly used to decouple applications or integrate applications. Messages can be stored in SQS for a short duration of time (maximum 14 days). SNS distributes several copies of messages to several subscribers. For example, let’s say you want to replicate data generated by an application to several storage systems. You could use SNS and send this data to multiple subscribers, each replicating the messages it receives to different storage systems (S3, hard disk on your host, database, etc.).
Best Answer
Your question
No.
AWS ECS
is just a logical grouping (cluster) ofEC2
instances, and all theEC2
instances part of anECS
act asDocker
host i.e. ECS can send command to launch a container on them (EC2
). If you already have an EC2, and then launch ECS, you'll still have a single instance. If you add/register (by installing the AWS ECS Container Agent) the EC2 to ECS it'll become the part of the cluster, but still a single instance of EC2.An Amazon ECS without any EC2 registered (added to the cluster) is good for nothing.
TL; DR
An overview
EC2
- is simply a remote (virtual) machine.ECS
stands forElastic Container Service
- as per basic definition of computer cluster,ECS
is basically a logical grouping ofEC2
machines/instances. Technically speakingECS
is a mere configuration for an efficient use and management of yourEC2
instance(s) resources i.e. storage, memory, CPU, etc.To simplify it further, if you have launched an
Amazon ECS
with noEC2
instances added to it, it's good for nothing i.e. you can't do anything about it.ECS
makes sense only once one (or more)EC2
instances are added to it.The next confusing thing here is the container term - which is not fully virtualized machine instances, and Docker is one technology we can use to create container instances.
Docker
is a utility you can install on our machine, which makes it aDocker
host, and on this host you can create containers (same as virtual machines - but much more light-weight). To sum up,ECS
is just about clustering of EC2 instances, and usesDocker
to instantiate containers/instances/virtual machines on these (EC2
) hosts.All you need to do is launch an
ECS
, and register/add as muchEC2
instances to it as you need. You can add/register EC2 instances, all you need is Amazon ECS Container Agent running on your EC2 instance/machine, which can be done manually or directly using the special AMI (Amazon Machine Image) i.e. Amazon ECS-optimized AMI, which already has the Amazon ECS Container Agent. During the launch of a new EC2 instance the Agent automatically registers it to the default ECS cluster.The container agent running on each of the instances (
EC2
instances) within anAmazon ECS
cluster sends information about the instance's current running tasks and resource utilization to Amazon ECS, and starts and stops tasks whenever it receives a request from Amazon ECS. For more information, see Amazon ECS Container Agent. Once set, each of the created container instances (of whateverEC2
machine/node) will be an instance inAmazon ECS
's swarm.For more information – read step 10 from this documentation: Launching an Amazon ECS Container Instance:
Just to clarify it further – you can create containers on your single
EC2
instance withoutECS
. Install any of the containerization technology i.e.Docker
and run the create container command, setting yourEC2
as aDocker
host, and have as muchDocker
containers as you want (or as much as yourEC2
's resources allow).