PHP code example of pin-cnx / laravel-aws-deploy

1. Go to this page and download the library: Download pin-cnx/laravel-aws-deploy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pin-cnx / laravel-aws-deploy example snippets


'ec2' => [
        'key' => env('EC2_KEY'),
        'secret' => env('EC2_SECRET'),
        'region' => env('EC2_REGION', 'ap-southeast-1'),
        'profiles' => [
            'AnyName' => [
                // The value with *** need to change to your own aws component name
                'AMI_PREFIX' => 'AWSDEPLOY', // Prefix for the AMI just for easy to regconize ie. AWSDEPLOY'
                'InstanceId' => '***i-0123456789abcdef', //The master instance id to clone ie. i-0123456789abcdef
                'KeyName' => '***serverkey', // The pem key name to access to the auto scale's instances
                'AutoScalingGroupName' => '***my-auto-scale', // The auto scale group name,
                'SecurityGroups' => '***sg-123456', // The security group of instance ie. sg-123456
                'InstanceType' => env('EC2_SIZE','t3.nano') , // 'Instance type ie. t2.micro',
                'VolumeSize' => 30, //(Optional) Default:30 SSD size
                'region' => ['ap-southeast-1a','ap-southeast-1b'], // Region to spawn instances
                'NoReboot' => false, //(Optional) Default:false Is it will reboot the master instance to make AMI
                'IsTerminateCurrentInstance' => true, //(Optional) Default:true Is it will terminate the old instance which launch with old configuration.
                'IamInstanceProfile' => null, //(Optional) Default:null
                'AMI_TAGS' => [ // (Optional) What ever tag you need for the new instances
                    [
                        'Key' => 'stage',
                        'Value' => 'aws-deploy',
                    ],
                    [
                        'Key' => 'Project',
                        'Value' => 'aws-deploy',
                    ]
                ]
                , 'UserData' => "#!/bin/bash \n" . // (Optional)The first boot command to the instances
                    "#su - www-data -c \"php /var/www/html/artisan queue:restart\""
            ]
        ]
    ]
bash
$ php artisan ec2backup
bash
$ php artisan ec2backup --profile AnyName