Hey guys, need some help. I am creating an ec2 ins...
# aws
c
Hey guys, need some help. I am creating an ec2 instance, it does get created but I’m unable to ssh into the instance.
Copy code
import * as aws from "@pulumi/aws";

const size = "t2.small";

const group = new aws.ec2.SecurityGroup("metabase-security-group", {
    ingress: [
        { protocol: "tcp", fromPort: 22, toPort: 22, cidrBlocks: ["0.0.0.0/0"], },
        { protocol: "tcp", fromPort: 80, toPort: 81, cidrBlocks: ["0.0.0.0/0"], },
        { protocol: "tcp", fromPort: 443, toPort: 443, cidrBlocks: ["0.0.0.0/0"], },
    ],
});

const deployerKeyPair = new aws.ec2.KeyPair("metabase-deployer", {
    publicKey: "<ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCzTEEaJVG3RGdKhSo/VWBRX0uD+MMcCAtqqYZpFsdoyhJ/oZQgJas7AoazepSKUCge3B+7Flu7jLyesF7JrQm24c0aOkL2nXvOhVIt/8RrK/BuSmB942kXfcwfht01ANFh5Qnt+oMrPgVldtdAqLYMXZvYeGBFmknznbbEckl9rHcN7axN0cZk81SToyX6sr7QLNrPJXtdrOXvNAQe/GHuv5UdVk7k2o+YKqHJoR0ymprQ8VK9RvsboBjFhfMmHNBB5zvWo0NZCO/BWWEfq7JtIgF8HA1xdXkTux+UeRq2lxp9HljBVk1If1BqPURn6cttB2Zv9nUjU+qprIP7hwSf4E6hn+I9C4Vfl+yDtKnHjgf1OHfpaTtDG1WcKPubU5YN8dJUFZ6lOt5W865nnOgImjfeEOAtKr7xJciHaI3ZVE4w1xbWv2sRMdcDLzkMOknnDhqAMGU0/S7Uv2gYLoBGsg/EPmt0FLMrLXE/Kn7zzSFzW76RWoxEIqESZqH1ZQk= nikhil_shrv@nikhils-mbp\n>",
});

const server = new aws.ec2.Instance("metabase-instance", {
    instanceType: size,
    vpcSecurityGroupIds: [ group.id ],
    ami: 'ami-09e67e426f25ce0d7', // Ubuntu 20.04
    keyName: deployerKeyPair.keyName,
});

export const publicIp = server.publicIp;
export const publicHostName = server.publicDns;
That’s the script I’m using. Any ideas what I am doing wrong?
b
What error do you get when trying to SSH?
c
ssh: connect to host 54.162.77.34 port 22: Operation timed out
That’s the ip I get from
publicIp
. I also waited a long time but on
ssh ubuntu@<the ip>
I get the above error
b
If you add icmp to your security group can you ping the instance?
c
I added custom icmp v4 echo request and tried pinging. This is the result
Copy code
ping 54.210.124.93
PING 54.210.124.93 (54.210.124.93): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
^C
--- 54.210.124.93 ping statistics ---
4 packets transmitted, 0 packets received, 100.0% packet loss
100% packet loss
b
did this get deployed in the default VPC?
c
yes
b
c
Sure. Let me check
I went through the checks and all of it looked fine. I then tried to change the instance type and tried out
I found something very weird
t2.micro - ssh works t2.small - ssh fail t2.medium - ssh works
😮 1
b
wow that is super weird
c
Yes it is
b
you might consider submitting an AWS ticket for that
c
And I did this multiple times
It is repeatable
b
also it's weird how a smaller instance works, it could have been put down to being out of resources but not if the smaller instance works!
c
So weird.
Anyways, thanks for your time, I really appreciate it
b
glad to help!
🙌 1