## Amazon CLI commands to manage S3 and SQS in Localstack and Laravel setup guideline. ### S3 commands #### To create new bucket: ```bash aws --endpoint-url=http://localhost:4566 s3 mb s3://your-bucket-name ``` #### Object list in bucket: ```bash aws s3api list-objects-v2 --bucket your-bucket-name --endpoint-url http://localhost:4566 ``` ### SQS commands #### To create new queue ```bash aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name your-queue-name ``` #### List available queues: ```bash aws --endpoint-url=http://localhost:4566 sqs list-queues ``` #### Job list in queue: * The latest job: ```bash aws --endpoint-url=http://localhost:4566 sqs receive-message --queue-url http://localhost:4566/000000000000/your-queue-name ``` * The latest 10 jobs: ```bash aws --endpoint-url=http://localhost:4566 sqs receive-message --queue-url http://localhost:4566/000000000000/your-queue-name --max-number-of-messages 10 ``` #### Purge queue jobs: ```bash aws --endpoint-url=http://localhost:4566 sqs purge-queue --queue-url=http://localhost:4566/000000000000/your-queue-name ``` #### Delete specific queue: ```bash aws --endpoint-url=http://localhost:4566 sqs delete-queue --queue-url http://localhost:4566/000000000000/your-queue-name ``` ### Laravel configuration #### S3 setup 1. Set `FILESYSTEM_DRIVER` key value to `s3`. 2. Set `AWS_USE_PATH_STYLE_ENDPOINT` to `true` 3. Create a new bucket and set `AWS_BUCKET`. 4. Set `AWS_ENDPOINT` to your host (default [localhost](http://localhost:4566/)). 5. `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` can be omitted since Localstack doesn't check them. #### SQS setup 1. Change `QUEUE_CONNECTION` key value to `sqs`. 2. Create new a queue and set its name to `SQS_QUEUE`. 3. Set `SQS_PREFIX` to `QueueUrl` which returned after creating new queue without queue name suffix.