Skip to content

Commit cb0cd37

Browse files
authored
Merge pull request #180 from laravel/feat/serverless-v2
Adds Aurora Serverless v2 support
2 parents caf923e + ae84246 commit cb0cd37

6 files changed

+15
-11
lines changed

src/Commands/DatabaseCommand.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,16 @@ protected function determineDatabaseType($public)
107107
return 'rds';
108108
}
109109

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

136-
if ($type == 'aurora-serverless') {
137+
if (in_array($type, ['aurora-serverless', 'aurora-serverless-v2'])) {
137138
return;
138139
}
139140

@@ -178,7 +179,7 @@ protected function determineRdsInstanceClass()
178179
*/
179180
protected function determineAllocatedStorage($type)
180181
{
181-
if ($type == 'aurora-serverless') {
182+
if (in_array($type, ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql'])) {
182183
return;
183184
}
184185

src/Commands/DatabaseListCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ public function handle()
3636
$database['cloud_provider']['name'],
3737
$database['name'],
3838
$database['region'],
39-
$database['type'] == 'aurora-serverless' ? 'Serverless' : 'Fixed Size',
39+
in_array($database['type'], ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql'])
40+
? 'Serverless'
41+
: 'Fixed Size',
4042
$database['instance_class'],
4143
$database['storage'].'GB',
4244
Str::title(str_replace('_', ' ', $database['status'])),

src/Commands/DatabaseShellCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function handle()
4646

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

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

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

src/Commands/DatabaseShowCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function handle()
4848
$database['cloud_provider']['name'],
4949
$database['name'],
5050
$database['region'],
51-
$database['type'] == 'aurora-serverless' ? 'Serverless' : 'Fixed Size',
51+
in_array($database['type'], ['aurora-serverless', 'aurora-serverless-v2', 'aurora-serverless-pgsql']) ? 'Serverless' : 'Fixed Size',
5252
$database['instance_class'],
5353
$database['storage'].'GB',
5454
Str::title(str_replace('_', ' ', $database['status'])),

src/Commands/DatabaseTunnelCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function findCompatibleJumpBox(array $database)
7070
return $jumpBox['network_id'] == $database['network_id'];
7171
});
7272

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

src/Commands/DatabaseUpgradeCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class DatabaseUpgradeCommand extends Command
1616
protected $databaseTypes = [
1717
'rds' => 'Fixed Size MySQL Instance 8.0 (Free Tier Eligible)',
1818
'rds-mysql-5.7' => 'Fixed Size MySQL Instance 5.7 (Free Tier Eligible)',
19-
'aurora-serverless' => 'Serverless MySQL Aurora Cluster',
19+
'aurora-serverless' => 'Serverless v1 MySQL 5.7 Aurora Cluster',
20+
'aurora-serverless-v2' => 'Serverless v2 MySQL 8.0 Aurora Cluster',
2021
'rds-pgsql-13.4' => 'Fixed Size PostgreSQL Instance 13.4',
2122
'rds-pgsql-11.10' => 'Fixed Size PostgreSQL Instance 11.10',
2223
'rds-pgsql' => 'Fixed Size PostgreSQL Instance 10.7',

0 commit comments

Comments
 (0)