Showing posts with label EC2. Show all posts
Showing posts with label EC2. Show all posts

AWS: region name: us-east-1b or ap-south-1 likely not supported, or AWS is down

Ansible and Dynamic Amazon EC2 Inventory Management


Error:



[root@ip-0.0.0.0]# /etc/ansible/ec2.py
region name: us-east-1b likely not supported, or AWS is down.  connection to region failed.

or

[root@ip-0.0.0.0]# /etc/ansible/ec2.py
region name: ap-south-1 likely not supported, or AWS is down.  connection to region failed.

Solution:

ec2.ini
Default value of 
regions = all
regions_exclude = us-gov-west-1,cn-north-1,ap-south-1,us-east-1b

One of regions not working which is us-east-1b so just add this in regions_exclude.

regions = all
regions_exclude = us-gov-west-1,cn-north-1,us-east-1b,ap-south-1

OR

regions = add-your-zone.

Run now.

[root@ip-host-name opt]# /etc/ansible/ec2.py
{
  "_meta": {
    "hostvars": {
      "IP": {
        "ansible_ssh_host": "IP",
        "ec2__in_monitoring_element": false,
        "ec2_ami_launch_index": "0",
        "ec2_architecture": "x86_64",
        "ec2_block_devices": {
          "sda1": "vol-84"
        },

Happy learning and implementation!!!

AWS EC2 Permission denied (publickey,gssapi-keyex,gssapi-with-mic

Issue:

 ssh -i "key-aws.pem" ec2-user@ec2-IP.compute-1.amazonaws.com

IP: 10.0.0.1

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for key-aws.pem are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: key-aws.pem
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

[vagrant@vagrant-centos65]$ chmod 400 key-aws.pem
[vagrant@vagrant-centos65]$ ls -ltr key-aws.pem
-r-xr-xr-x 1 vagrant vagrant 1692  key-aws.pem

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0555 for 'key-aws.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: key-aws.pem
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Solution:

Follow the below steps and it will resolved for sure;
1. Copy the key-aws.pem into /home/vagrant/.ssh/
    cp key-aws.pem /home/vagrant/.ssh/
2. Change the file permission to read for that user only.
     chmod 400 /home/vagrant/.ssh/key-aws.pem
     [vagrant@vagrant-centos65]$ ls -ltr /home/vagrant/.ssh/
     -r-------- 1 vagrant vagrant 1692 key-aws.pem
3. Execute ssh command now.
    ssh -i "/home/vagrant/.ssh/key-aws.pem" ec2-user@ec2-IP.compute-1.amazonaws.com   

Happy learning and implementation!!