diff --git a/pkg/cmd/roachprod/vm/aws/aws.go b/pkg/cmd/roachprod/vm/aws/aws.go index 68c4b011b939..e214a9171b88 100644 --- a/pkg/cmd/roachprod/vm/aws/aws.go +++ b/pkg/cmd/roachprod/vm/aws/aws.go @@ -89,17 +89,19 @@ const ( var defaultConfig = func() (cfg *awsConfig) { cfg = new(awsConfig) - if err := json.Unmarshal(MustAsset("old.json"), cfg); err != nil { + if err := json.Unmarshal(MustAsset("config.json"), cfg); err != nil { panic(errors.Wrap(err, "failed to embedded configuration")) } return cfg }() var defaultZones = []string{ + "us-east-2a", "us-east-2b", "us-east-2c", "us-west-2a", "us-west-2b", + "us-west-2c", "eu-west-2a", "eu-west-2b", "eu-west-2c", diff --git a/pkg/cmd/roachprod/vm/aws/keys.go b/pkg/cmd/roachprod/vm/aws/keys.go index 5aa37c517236..a5ff4558ef3a 100644 --- a/pkg/cmd/roachprod/vm/aws/keys.go +++ b/pkg/cmd/roachprod/vm/aws/keys.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "os" + "strings" "github.com/pkg/errors" ) @@ -71,7 +72,13 @@ func (p *Provider) sshKeyImport(keyName string, region string) error { "--key-name", keyName, "--public-key-material", string(keyBytes), } - return p.runJSONCommand(args, &data) + err = p.runJSONCommand(args, &data) + // If two roachprod instances run at the same time with the same key, they may + // race to upload the key pair. + if strings.Contains(err.Error(), "InvalidKeyPair.Duplicate") { + return nil + } + return err } // sshKeyName computes the name of the ec2 ssh key that we'll store the local user's public key in diff --git a/pkg/cmd/roachprod/vm/aws/support.go b/pkg/cmd/roachprod/vm/aws/support.go index e81bac901425..f8b646fe738c 100644 --- a/pkg/cmd/roachprod/vm/aws/support.go +++ b/pkg/cmd/roachprod/vm/aws/support.go @@ -16,6 +16,7 @@ package aws import ( + "bytes" "encoding/json" "io/ioutil" "log" @@ -144,15 +145,16 @@ func (p *Provider) runCommand(args []string) ([]byte, error) { if p.opts.Profile != "" { args = append(args[:len(args):len(args)], "--profile", p.opts.Profile) } - + var stderrBuf bytes.Buffer cmd := exec.Command("aws", args...) - + cmd.Stderr = &stderrBuf output, err := cmd.Output() if err != nil { if exitErr, ok := err.(*exec.ExitError); ok { log.Println(string(exitErr.Stderr)) } - return nil, errors.Wrapf(err, "failed to run: aws %s", strings.Join(args, " ")) + return nil, errors.Wrapf(err, "failed to run: aws %s: stderr: %v", + strings.Join(args, " "), stderrBuf.String()) } return output, nil } diff --git a/pkg/cmd/roachprod/vm/aws/terraform/aws-region/main.tf b/pkg/cmd/roachprod/vm/aws/terraform/aws-region/main.tf index 89d56e09861b..77ed8a44d7d0 100644 --- a/pkg/cmd/roachprod/vm/aws/terraform/aws-region/main.tf +++ b/pkg/cmd/roachprod/vm/aws/terraform/aws-region/main.tf @@ -32,7 +32,7 @@ output "vpc_info" { } } -output "extended_vpc_info" { +output "region_info" { value = { "region" = "${var.region}" "security_group" = "${aws_security_group.region_security_group.id}" diff --git a/pkg/cmd/roachprod/vm/aws/terraform/aws-region/network.tf b/pkg/cmd/roachprod/vm/aws/terraform/aws-region/network.tf index f55f3d7c94ab..932b2d01d7a4 100644 --- a/pkg/cmd/roachprod/vm/aws/terraform/aws-region/network.tf +++ b/pkg/cmd/roachprod/vm/aws/terraform/aws-region/network.tf @@ -58,10 +58,10 @@ data "aws_availability_zone" "zone_detail" { # One VPC per region, with CIDR 10..0.0/8. resource "aws_vpc" "region_vpc" { - cidr_block = "${cidrsubnet("10.0.0.0/8", 8, local.region_number[var.region])}" - + cidr_block = "${cidrsubnet("10.0.0.0/8", 8, local.region_number[var.region])}" + enable_dns_hostnames = true tags { - Name = "${var.label}-vpc-${var.region}" + Name = "${var.label}-vpc-${var.region}" } }