https://pulumi.com logo
Title
c

colossal-battery-24701

05/12/2021, 3:39 PM
Hey guys, need some help. I am creating an ec2 instance, it does get created but I’m unable to ssh into the instance.
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

billowy-army-68599

05/12/2021, 3:44 PM
What error do you get when trying to SSH?
c

colossal-battery-24701

05/12/2021, 3:44 PM
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

billowy-army-68599

05/12/2021, 3:55 PM
If you add icmp to your security group can you ping the instance?
c

colossal-battery-24701

05/12/2021, 4:06 PM
I added custom icmp v4 echo request and tried pinging. This is the result
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

billowy-army-68599

05/12/2021, 4:29 PM
did this get deployed in the default VPC?
c

colossal-battery-24701

05/12/2021, 4:34 PM
yes
b

billowy-army-68599

05/12/2021, 4:38 PM
c

colossal-battery-24701

05/12/2021, 4:43 PM
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

billowy-army-68599

05/12/2021, 5:12 PM
wow that is super weird
c

colossal-battery-24701

05/12/2021, 5:12 PM
Yes it is
b

billowy-army-68599

05/12/2021, 5:12 PM
you might consider submitting an AWS ticket for that
c

colossal-battery-24701

05/12/2021, 5:12 PM
And I did this multiple times
It is repeatable
b

billowy-army-68599

05/12/2021, 5:13 PM
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

colossal-battery-24701

05/12/2021, 5:13 PM
So weird.
Anyways, thanks for your time, I really appreciate it
b

billowy-army-68599

05/12/2021, 5:14 PM
glad to help!
🙌 1