Docker Local SQS with AWS CLI pre-configured, This image is extension of roribio16/alpine-sqs:latest
basic docker-compose.yml file has been added, can be used as a reference.
docker-compose up -d
All AWS cli commands should work normally, Below is a sample command to make a new queue
docker-compose exec sqs aws --endpoint-url http://localhost:9324 sqs create-queue --queue-name test
Above command will return you following response:
{
"QueueUrl": "http://localhost:9324/queue/test"
}
Now you can use this Queue URL in your other services, You can either use service name of add network and assign alias to this service in order to be accessed by other services.
You can use below configurations in your projects with AWS SQS libraries to use from other services
KEY: notValidKey
SECRET: notValidSecret
REGION: eu-central-1
ENDPOINT: {ALIAS OR NAME OF SERVICE}:9324
QUEUE_URL: http://{ALIAS OR NAME OF SERVICE}:9324/queue/{QUEUE NAME}
Below is example usage, in this case sqs service has been assigned a network alias sqs.local
KEY: notValidKey
SECRET: notValidSecret
REGION: eu-central-1
ENDPOINT: sqs.local:9324
QUEUE_URL: http://sqs.local:9324/queue/watto
You'll have to disable SSL, If your docker setup is not allowing http response to https or you are getting error like "server gave HTTP response to HTTPS", then you can use below code as reference
awsConfig := aws.NewConfig().
WithRegion({REGION}).
WithCredentials(credentials.NewStaticCredentialsFromCreds(credentials.Value{
AccessKeyID: {KEY},
SecretAccessKey: {SECRET},
}))
if devMode == true {
awsConfig = awsConfig.
WithEndpoint({ENDPOINT}).
WithDisableSSL(true)
}
sess, err := session.NewSession(awsConfig)