laravel/symfony-component). The core logic (AWS SDK interactions) is language-agnostic.aws/aws-sdk-php (v3+). Laravel’s guzzlehttp/guzzle or aws/aws-sdk-php must be pre-installed for compatibility.Artisan CLI is compatible with Symfony-style commands. The bundle’s commands can be:
Illuminate\Console\Command) orConsoleApplication in a hybrid setup.Aws\CloudWatchLogs\CloudWatchLogsClient) can be injected into Laravel services using container bindings.config/packages/draw_aws_tool_kit.yaml can be mapped to Laravel’s config/aws.php via package discovery or manual overrides.config/services.php or environment variables (AWS_ACCESS_KEY_ID).aws_client_id/aws_client_secret config keys.--aws-newest-instance-role relies on EC2 instance metadata (169.254.169.254/latest/meta-data/instance-id).aws/aws-sdk-php version (e.g., v3.200+)? Test compatibility with composer why-not aws/aws-sdk-php:^3.200.env('AWS_ACCESS_KEY_ID')) map to the bundle’s expected config?laravel:draw:aws:cloud-watch-logs:download) to avoid conflicts?RuntimeException) compatible with Laravel’s Artisan error display?Mockery/PHPUnit integration.newest-instance-role logic work in non-EC2 environments (e.g., Lambda, Fargate)?symfony/console, symfony/dependency-injection) via:
// config/app.php
'providers' => [
\Draw\AwsToolKitBundle\DrawAwsToolKitBundle::class,
],
aws/aws-sdk-php is installed and configured in config/aws.php:
'default' => env('AWS_REGION', 'us-east-1'),
'credentials' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
],
Artisan::call() to invoke bundle commands:
Artisan::call('draw:aws:cloud-watch-logs:download', [
'logGroup' => '/aws/rds/cluster/prod-dbcluster/slowquery',
'logStream' => 'prod-1',
'output' => './tmp/slow-log.log',
]);
Phase 1: Command-Only Integration
composer require draw/aws-tool-kit-bundle).config/app.php.php artisan draw:aws:cloud-watch-logs:download.Phase 2: Service Integration
CloudWatchLogsClient) into Laravel services:
// app/Services/AwsLogService.php
class AwsLogService {
public function __construct(private CloudWatchLogsClient $client) {}
public function downloadLog(string $logGroup, string $logStream): string {
// Use bundle's logic or rewrite in Laravel style
}
}
AppServiceProvider:
$this->app->bind(CloudWatchLogsClient::class, function () {
return new CloudWatchLogsClient([
'version' => 'latest',
'region' => config('aws.region'),
'credentials' => config('aws.credentials'),
]);
});
Phase 3: Auto-Scaling Logic
--aws-newest-instance-role with a Laravel service:
// app/Services/InstanceRoleService.php
class InstanceRoleService {
public function isNewestInstance(string $role): bool {
$instanceId = file_get_contents('http://169.254.169.254/latest/meta-data/instance-id');
// Fetch all instances with role $role from EC2, compare timestamps
}
}
// app/Http/Middleware/CheckInstanceRole.php
public function handle(Request $request, Closure $next) {
if (!$this->instanceRoleService->isNewestInstance('prod')) {
abort(403, 'Not the newest instance.');
}
return $next($request);
}
aws/aws-sdk-php versions align (bundle may use v3.100; Laravel may use v3.200).composer.json).symfony/console (v5.4+) should suffice, but test for:
Symfony\Component\Console\Command\Command inheritance.Symfony\Component\DependencyInjection container quirks..env before using commands.draw:aws:cloud-watch-logs:download with a small log group.InstanceRoleService only after confirming EC2 metadata access.throw new \RuntimeException() → throw new \InvalidArgumentException()).draw/aws-tool-kit-bundle for updates (low signal due to 0 stars).aws/aws-sdk-php updates may break bundle compatibility. Plan for:
config/packages/draw_aws_tool_kit.yaml vs. config/aws.php).Log facade. Add:
use Illuminate\Support\Facades\Log;
Log::error('AWS Error', ['exception' => $e]);
cloudwatch:GetLogEvents) for the bundle’s commands.Aws\Common\Credentials\RateLimiter.newest-instance-role logic scales poorly in multi-region deployments. Consider:
How can I help you explore Laravel packages today?