Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Aurora Serverless v2 support #180

Merged
merged 2 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Commands/DatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ protected function determineDatabaseType($public)
return 'rds';
}

return tap($this->option('serverless') ? 'aurora-serverless' : $this->menu('Which type of database would you like to create?', [
return tap($this->option('serverless') ? 'aurora-serverless-v2' : $this->menu('Which type of database would you like to create?', [
'rds' => 'Fixed Size MySQL Instance 8.0 (Free Tier Eligible)',
'rds-mysql-5.7' => 'Fixed Size MySQL Instance 5.7 (Free Tier Eligible)',
'aurora-serverless' => 'Serverless MySQL Aurora Cluster',
'aurora-serverless' => 'Serverless v1 MySQL 5.7 Aurora Cluster',
'aurora-serverless-v2' => 'Serverless v2 MySQL 8.0 Aurora Cluster',
'rds-pgsql-13.4' => 'Fixed Size PostgreSQL Instance 13.4',
'rds-pgsql-11.10' => 'Fixed Size PostgreSQL Instance 11.10',
'aurora-serverless-pgsql' => 'Serverless PostgreSQL Aurora Cluster',
]), function ($type) use ($public) {
if ($type == 'aurora-serverless' && $public) {
if (in_array($type, ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql']) && $public) {
Helpers::abort('Aurora Serverless clusters may not be publicly accessible.');
}
});
Expand All @@ -133,7 +134,7 @@ protected function determineInstanceClass($type)
return 'db.t3.micro';
}

if ($type == 'aurora-serverless') {
if (in_array($type, ['aurora-serverless', 'aurora-serverless-v2'])) {
return;
}

Expand Down Expand Up @@ -178,7 +179,7 @@ protected function determineRdsInstanceClass()
*/
protected function determineAllocatedStorage($type)
{
if ($type == 'aurora-serverless') {
if (in_array($type, ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql'])) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Commands/DatabaseListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public function handle()
$database['cloud_provider']['name'],
$database['name'],
$database['region'],
$database['type'] == 'aurora-serverless' ? 'Serverless' : 'Fixed Size',
in_array($database['type'], ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql'])
? 'Serverless'
: 'Fixed Size',
$database['instance_class'],
$database['storage'].'GB',
Str::title(str_replace('_', ' ', $database['status'])),
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/DatabaseShellCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function handle()

$user = $this->findDatabaseUser($database);

if (in_array($database['type'], ['rds', 'rds-mysql-5.7', 'aurora-serverless'])) {
if (in_array($database['type'], ['rds', 'rds-mysql-5.7', 'aurora-serverless', 'aurora-serverless-v2'])) {
passthru(sprintf(
'ssh -t ec2-user@%s -i %s -o LogLevel=error "mysql -u %s -p%s -h %s vapor"',
$jumpBox['endpoint'],
Expand Down Expand Up @@ -79,7 +79,7 @@ protected function findCompatibleJumpBox(array $database)
return $jumpBox['network_id'] == $database['network_id'];
});

$jumpBox = in_array($database['type'], ['rds', 'aurora-serverless'])
$jumpBox = in_array($database['type'], ['rds', 'aurora-serverless', 'aurora-serverless-v2'])
? $jumpBoxes->first()
: $jumpBoxes->firstWhere('version', '>', 1);

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DatabaseShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function handle()
$database['cloud_provider']['name'],
$database['name'],
$database['region'],
$database['type'] == 'aurora-serverless' ? 'Serverless' : 'Fixed Size',
in_array($database['type'], ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql']) ? 'Serverless' : 'Fixed Size',
$database['instance_class'],
$database['storage'].'GB',
Str::title(str_replace('_', ' ', $database['status'])),
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/DatabaseTunnelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function findCompatibleJumpBox(array $database)
return $jumpBox['network_id'] == $database['network_id'];
});

$jumpBox = in_array($database['type'], ['rds', 'aurora-serverless'])
$jumpBox = in_array($database['type'], ['rds', 'aurora-serverless', 'aurora-serverless-v2'])
? $jumpBoxes->first()
: $jumpBoxes->firstWhere('version', '>', 1);

Expand Down
3 changes: 2 additions & 1 deletion src/Commands/DatabaseUpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class DatabaseUpgradeCommand extends Command
protected $databaseTypes = [
'rds' => 'Fixed Size MySQL Instance 8.0 (Free Tier Eligible)',
'rds-mysql-5.7' => 'Fixed Size MySQL Instance 5.7 (Free Tier Eligible)',
'aurora-serverless' => 'Serverless MySQL Aurora Cluster',
'aurora-serverless' => 'Serverless v1 MySQL 5.7 Aurora Cluster',
'aurora-serverless-v2' => 'Serverless v2 MySQL 8.0 Aurora Cluster',
'rds-pgsql-13.4' => 'Fixed Size PostgreSQL Instance 13.4',
'rds-pgsql-11.10' => 'Fixed Size PostgreSQL Instance 11.10',
'rds-pgsql' => 'Fixed Size PostgreSQL Instance 10.7',
Expand Down