I want using another SG’s port for SSH, not 22, but i get error.
For example:
resource "aws_security_group" "ws_sg" {
name = "WS SG"
vpc_id = "${aws_vpc.ws_net.id}"
tags = {
"Name" = "WS SG"
}
}
resource "aws_security_group_rule" "inbound_ssh" {
from_port = 28
protocol = "TCP"
security_group_id = aws_security_group.ws_sg.id
to_port = 22
type = "ingress"
cidr_blocks = [ "0.0.0.0/0" ]
}
resource "aws_security_group_rule" "egress" {
from_port = 0
protocol = "all"
security_group_id = aws_security_group.ws_sg.id
to_port = 0
type = "egress"
cidr_blocks = [ "0.0.0.0/0" ]
}
How fix it?
P.S. Maybee, this happing because i have free account?
2
Answers
I some hastened. Not working
I tried connect PuTTY to port 28 and i got: Network error: Connection refused
If i change SG's inbounds for SSH 22, then connect to port 22 without problem. But if i change 22-28, that's all guys )
You mixed up your ports. Instead of
it should be: