簡體   English   中英

Ansible - 區域 us-east-2a 似乎不適用於 aws 模塊 boto.ec2

[英]Ansible - Region us-east-2a does not seem to be available for aws module boto.ec2

我正在嘗試使用 Ansible 創建 EC2 實例,但它顯示以下錯誤:

區域 us-east-2a 似乎不適用於 aws 模塊 boto.ec2。 如果該區域確實存在,您可能需要升級 boto 或使用 endpoints_path 進行擴展。

我不得不說我使用的是Ansible 版本 2.3.1.0Boto 2.480

嘗試創建安全組后立即顯示錯誤:

---
  - name: Provision an EC2 Instance
    hosts: localhost
    connection: local
    gather_facts: False
    tags: provisioning
    # Necessary Variables for creating/provisioning the EC2 Instance
    vars_files: 
      - variables.yml
      - aws_auth.yml
    # Task that will be used to Launch/Create an EC2 Instance
    tasks:
      -   name: Create security group
              ec2_group:
              name: "{{ project_name }}_security_group"
              description: "{{ project_name }} security group"
              region: "{{ aws_region }}"
          rules:
              - proto: tcp
                type: ssh
                from_port: 22
                to_port: 22
                cidr_ip: 0.0.0.0/0
              - proto: tcp
                type: http
                from_port: 80
                to_port: 80
                cidr_ip: 0.0.0.0/0
              - proto: tcp
                type: https
                from_port: 443
                to_port: 443
                cidr_ip: 0.0.0.0/0
          rules_egress:
              - proto: all
                type: all
                cidr_ip: 0.0.0.0/0
      register: basic_firewall

訪問密鑰和秘密密鑰已正確導出。 我可以運行 /etc/ansible/ec2.py --list 並顯示所有預期數據。

謝謝你。

us-east-2a不是區域,而是可用區 該區域稱為us-east-2

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html

我在使用 ansible (2.9.6) 和rds模塊時發現了這個問題:

- name: register db_facts
  rds:
    command: facts
    aws_access_key: "AWS_ACCESS_KEY"
    aws_secret_key: "AWS_SECRET_KEY"
    aws_region: "AWS_REGION_KEY"
    instance_name: "NAME_OF_RDS_INSTANCE"
  register: db_facts

問題是我正在配置一個 Ubuntu 16.04 實例和python-boto包。 可用的 boto 庫很舊,所以它沒有所需的區域,因為我可以使用 python 確認:

>>> import boto.ec2
>>> for i in boto.ec2.regions():
...   print(i)
...
RegionInfo:us-east-1
RegionInfo:cn-north-1
RegionInfo:ap-northeast-1
RegionInfo:eu-west-1
RegionInfo:ap-southeast-1
RegionInfo:ap-southeast-2
RegionInfo:us-west-2
RegionInfo:us-gov-west-1
RegionInfo:us-west-1
RegionInfo:eu-central-1
RegionInfo:sa-east-1

我安裝了更新版本的庫來解決這個問題:

pip install boto --upgrade

這是升級庫的結果:

>>> import boto.ec2
>>> for i in boto.ec2.regions():
...   print(i)
...
RegionInfo:us-west-1
RegionInfo:us-east-1
RegionInfo:ap-northeast-1
RegionInfo:ap-southeast-2
RegionInfo:sa-east-1
RegionInfo:ap-northeast-2
RegionInfo:us-east-2
RegionInfo:ap-southeast-1
RegionInfo:ca-central-1
RegionInfo:cn-north-1
RegionInfo:us-west-2
RegionInfo:us-gov-west-1
RegionInfo:ap-south-1
RegionInfo:eu-central-1
RegionInfo:eu-west-1
RegionInfo:eu-west-2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM