// waitForCopy waits for the RDS snapshot copy to finish func (c *config) waitForCopy() error { c.debug(fmt.Sprintf("Waiting for copy %s...", c.copyId)) cli := rds.New(session.New(), &aws.Config{Region: aws.String(c.dst)}) q := rds.DescribeDBSnapshotsInput{} q.DBSnapshotIdentifier = aws.String(c.copyId) for { resp, err := cli.DescribeDBSnapshots(&q) if err != nil { return err } if len(resp.DBSnapshots) != 1 { return fmt.Errorf("New snapshot missing!") } s := resp.DBSnapshots[0] if *s.Status != "creating" { break } c.debug(fmt.Sprintf("Waiting %s (%d%% complete)", *s.Status, *s.PercentProgress)) time.Sleep(10 * time.Second) } return nil }