Setup EC2 and VPC - AWS
Setup EC2 and VPC - AWS
Launch EC2 VM :
Step1: Login to AWS Console with user credentials
Step 2: After login into the account then go to home page of aws console
Step 3 : search ec2 home page
Summery
Step 5: Instance is running
Here under inbound rules add custom tcp port 22 why because port 22 is default ssh connection
Inbound rules
Outbound rules all traffic
Step 8:
Connect aws instance using private ip address getting error
● For CentOS/RHEL:
The error "Load key 'prometheus.ppk': error in libcrypto" suggests an issue with the private key
file or its compatibility with the SSH client. Since you are using MobaXterm, you might want to
ensure that the key file is correctly loaded and that MobaXterm is handling the key conversion
properly.
Here are steps you can take to resolve the issue:
Check Key Format:
● Ensure that the private key file (prometheus.ppk) is in the correct format.
MobaXterm uses its own private key format, so it's important to make sure the
key is in the right format for OpenSSH.
Convert Key to OpenSSH Format:
● Use MobaXterm itself to convert the key to OpenSSH format:
● Open MobaXterm.
● Go to the "Tools" menu.
● Select "MobaKeyGen."
● Load your private key (prometheus.ppk).
● In the "Conversions" menu, choose "Export OpenSSH key" and save the
key with a .pem extension.
ssh-add -l
● If the key is not listed, add it using:
ssh-add /path/to/prometheus.pem
Verify Permissions:
● Ensure that the permissions for the private key file are set correctly:
✴️ Use "EC2 instance Connect" to connect to RDS and other VPC resources — no VPN required, no
EC2 Bastion instance needed 🔥
⚠️
𝚜𝚞𝚋𝚗𝚎𝚝-𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿𝚊𝚋𝚌𝚍𝚎𝚏
Change "region" and "subnet-id" to your values.
4️⃣ Connect to the local port (localhost:5432 from the example above) and that's it!👍
It definitely works for IPs from other VPCs connected via VPC Peering. I haven't tried it for another —
let me know if it doesn't work.
Creation of the Endpoint Under VPC Dashboard:
EIC EndPoint:
IAM Inline Policy is created Under the specific User:
This is the policy of eice-ploicy inline policy created under the user
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllEC2Actions",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeInstanceConnectEndpoints"
],
"Resource": "*"
},
{
"Sid": "AllowSpecificActionsForUserARN",
"Effect": "Allow",
"Action": [
"ec2-instance-connect:OpenTunnel",
"ec2-instance-connect:SendSSHPublicKey"
],
"Resource": [
"arn:aws:ec2:us-east-2:AccountNumber:instance-connect-endpoint/eice-0cdcda4db3e069304",
"arn:aws:ec2:us-east-2:Account Number
:instance/i-0a8b962883bd3c729"
]
}
]
}
Connect Private IP Address Testing :
Step1: Goto AWS Console and search vpc and open vpc
dashboard.