Categorygithub.com/acorn-io/aws/sqs
modulepackage
0.3.0
Repository: https://github.com/acorn-io/aws.git
Documentation: pkg.go.dev

# README

SQS Acorn

Description

This Acorn provisions an AWS SQS queue.

Usage

From the CLI you can deploy the default SQS queue using the following command:

acorn run ghcr.io/acorn-io/aws/sqs:v0.#.#

From the Acornfile you can launch an SQS queue using the following:

services: queue: {
    image: ghcr.io/acorn-io/aws/sqs:v0.#.#
}

containers: publisher: {
    image: "app"
    consumes: ["queue.publisher"]
    env: QUEUE_NAME: "@{services.queue.data.name}"
    env: QUEUE_URL:  "@{services.queue.data.url}"
}

container: subscriber: {
    image: "app"
    consumes: ["queue.subscriber"]
    env: QUEUE_NAME: "@{services.queue.data.name}"
    env: QUEUE_URL:  "@{services.queue.data.url}"
}

The above Acornfile shows two containers consuming different roles from the SQS Acorn. The publisher container has the ability to publish messages to the queue, while the subscriber container has the ability to receive messages from the queue.

There is a default service in the SQS Acorn in this case it is named queue and it is an alias for queue.admin which has administrative rights to the queue.

Arguments

NameDescriptionType
queueNameName of queue. Defaults to acorn.externalIDstring
fifoEnable FIFO for the queuebool
visibilityTimeoutDuration in seconds. Default is 30 seconds.int
contentBasedDeduplicationFifo Queue Option Only: ContentBasedDeduplication is a boolean that enables content-based deduplication.bool
dataKeyReuseAmount of time in seconds SQS reuses data key before calling KMS againint
maxReceiveCountNumber of times a message can be unsuccessfully dequeued before being sent to the dead letter queue. A number >0 will create a new deadletter queueint
encryptionMasterKeyKMS Key arn to use for encryption. Default is to use Amazon SQS keystring
tagsKey value pairs to apply to all AWS resources created by this Acornobject

Service Outputs

The SQS Acorn provides three roles for use by applications. These can be used to provide least privilege access to your SQS queue from each container.

services: {
    admin: {
        default: true
        address: "${address}"
        consumer: permissions: rules: [{
            apiGroup: "aws.acorn.io"
      verbs: [
       "sqs:*",
      ]
      resources: ["${arn}"]
        }]
        data: {
            arn: "${arn}"
            proto: "${proto}"
            url: "${url}"
            uri: "${uri}"
            name: "${name}"
        }
    }
    publisher: {
        address: "${address}"
        consumer: permissions: rules: [{
            apiGroup: "aws.acorn.io"
            verbs: [
                "sqs:GetQueueUrl",
                "sqs:SendMessage",
            ]
            resources: ["${arn}"]
        }]
        data: {
            arn: "${arn}"
            proto: "${proto}"
            url: "${url}"
            uri: "${uri}"
            name: "${name}"
        }
    }
    subscriber: {
        address: "${address}"
        consumer: permissions: rules: [{
            apiGroup: "aws.acorn.io"
            verbs: [
                "sqs:ReceiveMessage",
                "sqs:DeleteMessage",
                "sqs:ChangeMessageVisibility",
                "sqs:GetQueueUrl",
            ]
            resources: ["${arn}"]
        }]
        data: {
            arn: "${arn}"
            proto: "${proto}"
            url: "${url}"
            uri: "${uri}"
            name: "${name}"
        }
    }
}

# Functions

No description provided by the author
No description provided by the author

# Structs

No description provided by the author