# GitLab issues connecting to us-gov-west-1

**URL:** <https://forum.ansible.com/t/gitlab-issues-connecting-to-us-gov-west-1/24977>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [July 13, 2017, 9:04pm UTC](https://forum.ansible.com/t/gitlab-issues-connecting-to-us-gov-west-1/24977 "2017-07-13T21:04:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Long](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Brian\_Long](https://forum.ansible.com/u/Brian_Long)\
**Post date:** [July 13, 2017, 9:04pm UTC](https://forum.ansible.com/t/gitlab-issues-connecting-to-us-gov-west-1/24977/1 "2017-07-13T21:04:27Z")

</div>

Hi All,

**_Note_** : I’ve posted this question to StackOverflow as well: [https://stackoverflow.com/q/45090838/320399](https://stackoverflow.com/q/45090838/320399)

There’s a [GitLab.com](http://GitLab.com) update rolling out today, and I’m seeing issues connecting to a particular AWS region with Ansible: us-gov-west-1.

This is odd, since in my CI job, I’m able to use the AWS CLI just fine:

**### CI build step**

$ aws ec2 describe-instances

**### Output (truncated)**  
{  
“Reservations”: [  
{  
“Instances”: [  
{  
“Monitoring”: {  
“State”: “disabled”  
},  
“PublicDnsName”: "ec2-…

The very build step is as follows, notice that it fails to connect to the region:

**### CI build step**

**$ ansible-playbook -vvv -i inventory/ec2.py -e ansible\_ssh\_private\_key\_file=aws-keypairs/gitlab\_keypair.pem playbooks/deploy.yml**

**### Output (truncated)**  
Using /builds/me/my-project/ansible.cfg as config file ERROR! Attempted to execute “inventory/ec2.py” as inventory script: Inventory script (inventory/ec2.py) had an execution error: region name: us-gov-west-1 likely not supported, or AWS is down. connection to region failed. ERROR: Job failed: exit code 1

Is anyone else seeing this?

It was working this morning. Any idea why this might be failing now?

Thanks!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 13, 2017, 10:47pm UTC](https://forum.ansible.com/t/gitlab-issues-connecting-to-us-gov-west-1/24977/2 "2017-07-13T22:47:53Z")

</div>

That normally means your account does not have access to us-gov (which  
is restricted to special accounts) or that the AWS API and/or region  
was down.

---

<div class="post-metadata">

**Author:** ![Brian\_Long](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Brian\_Long](https://forum.ansible.com/u/Brian_Long)\
**Post date:** [July 14, 2017, 12:12pm UTC](https://forum.ansible.com/t/gitlab-issues-connecting-to-us-gov-west-1/24977/3 "2017-07-14T12:12:23Z")

</div>

Hi Brian,

Thanks for the email. It might have been the push I needed to find the bug 🙂

I wrote a small Python script to dive deeper into boto. When I googled how to list the regions,I was reminded of the differences in boto 2 vs boto 3. Then, I reviewed the mechanism I was using to install boto. It looks like the boto installation was the problem.

Here’s the buggy version of my .gitlab-ci.yml file:

```auto
image: ansible/ansible:ubuntu1604

test_aws:
  stage: deploy
  before_script:
    - apt-get update
    - apt-get -y install python 
    - apt-get -y install python-boto python-pip
    - pip install awscli
  script:
    - 'aws ec2 describe-instances'

deploy_app:
  stage: deploy
  before_script:
    - apt-get update
    - apt-get -y install python 
    - apt-get -y install python-boto python-pip
    - pip install awscli
  script:
    - 'chmod 400 aws-keypairs/gitlab_keypair.pem'
    - 'ansible-playbook -vvv -i inventory/ec2.py -e ansible_ssh_private_key_file=aws-keypairs/gitlab_keypair.pem playbooks/deploy.yml'

```

And here’s the fixed version:

```auto
image: ansible/ansible:ubuntu1604

all_in_one:
  stage: deploy
  before_script:
    - rm -rf /var/lib/apt/lists/*
    - apt-get update
    - apt-get -y install python python-pip
    - pip install boto==2.48.0
    - pip install awscli
    - pip install ansible==2.2.2.0
  script:
    - 'chmod 400 aws-keypairs/gitlab_keypair.pem'
    - 'aws ec2 describe-instances'
    - 'python ./boto_debug.py'
    - 'ansible-playbook -vvv -i inventory/ec2.py -e ansible_ssh_private_key_file=aws-keypairs/gitlab_keypair.pem playbooks/deploy.yml'

```

Notice that I switched from using `apt-get install` to using `pip install`. Hopefully others will come across this post in the future and avoid installing boto with `apt-get -y install python-boto`!

Thanks all,
