`aws: error: argument --region: expected one argument` when running Kubernetes on AWS

5/21/2016

I'm following this guide to set up Kubernetes on an Ubuntu 14.04 image on AWS.

sudo apt-get update
sudo apt-get install curl
sudo apt-get install awscli
aws configure # enter credentials, etc.

# fix `locale` errors
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

export KUBE_AWS_ZONE=us-east-1b
export NUM_NODES=2
export MASTER_SIZE=t2.micro
export NODE_SIZE=t2.micro
export AWS_S3_BUCKET=my.s3.bucket.kube
export AWS_S3_REGION=us-east-1b
export INSTANCE_PREFIX=k8s

export KUBERNETES_PROVIDER=aws
curl -sS https://get.k8s.io | bash

This fails, however...

ubuntu@ip-172-31-24-216:~$ curl -sS https://get.k8s.io | bash
Downloading kubernetes release v1.2.4 to /home/ubuntu/kubernetes.tar.gz
--2016-05-21 17:01:20--  https://storage.googleapis.com/kubernetes-release/release/v1.2.4/kubernetes.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 74.125.29.128, 2607:f8b0:400d:c03::80
Connecting to storage.googleapis.com (storage.googleapis.com)|74.125.29.128|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 496696744 (474M) [application/x-tar]
Saving to: ‘kubernetes.tar.gz’

100%[======================================>] 496,696,744 57.4MB/s   in 8.2s

2016-05-21 17:01:29 (58.1 MB/s) - ‘kubernetes.tar.gz’ saved [496696744/496696744]

Unpacking kubernetes release v1.2.4
Creating a kubernetes on aws...
... Starting cluster in us-east-1b using provider aws
... calling verify-prereqs
... calling kube-up
Starting cluster using os distro: jessie
Uploading to Amazon S3
+++ Staging server tars to S3 Storage: my.s3.bucket.kube/devel
usage: aws [options] <command> <subcommand> [parameters]
aws: error: argument --region: expected one argument

I tried editing cluster/aws/util.sh to print out s3_bucket_location (following advice from this question, and I get an empty string. I'm guessing that's why it fails?

The docs say an empty string for US East is normal, but I tried changing region (with everything else remaining the same) and I still get an empty string.

The s3 bucket does get created.

Any help would be appreciated.

-- user1953221
amazon-web-services
kubernetes

1 Answer

6/4/2016

Looks to me like you are getting region and zone confused.

Use the ec2-describe-regions command as follows to describe your regions.

PROMPT> ec2-describe-regions
REGION us-east-1  ec2.us-east-1.amazonaws.com
REGION  ap-northeast-1  ec2.ap-northeast-1.amazonaws.com
REGION  ap-southeast-1  ec2.ap-southeast-1.amazonaws.com
..
Use the ec2-describe-availability-zones command as follows to describe your Availability Zones within the us-east-1 region.

PROMPT>  ec2-describe-availability-zones --region us-east-1
AVAILABILITYZONE    us-east-1a  available   us-east-1
AVAILABILITYZONE    us-east-1b  available   us-east-1
AVAILABILITYZONE    us-east-1c  available   us-east-1
AVAILABILITYZONE    us-east-1d  available   us-east-1

be sure to use a region in export AWS_S3_REGION=

-- Drew
Source: StackOverflow