Skip to main content

subscriptions

Creates, updates, deletes or gets a subscription resource or lists subscriptions in a region

Overview

Namesubscriptions
TypeResource
DescriptionResource Type definition for AWS::SNS::Subscription
Idawscc.sns.subscriptions

Fields

NameDatatypeDescription
arnstringArn of the subscription
replay_policyobjectSpecifies whether Amazon SNS resends the notification to the subscription when a message's attribute changes.
raw_message_deliverybooleanWhen set to true, enables raw message delivery. Raw messages don't contain any JSON formatting and can be sent to Amazon SQS and HTTP/S endpoints.
endpointstringThe subscription's endpoint. The endpoint value depends on the protocol that you specify.
filter_policyobjectThe filter policy JSON assigned to the subscription. Enables the subscriber to filter out unwanted messages.
topic_arnstringThe ARN of the topic to subscribe to.
redrive_policyobjectWhen specified, sends undeliverable messages to the specified Amazon SQS dead-letter queue. Messages that can't be delivered due to client errors are held in the dead-letter queue for further analysis or reprocessing.
delivery_policyobjectThe delivery policy JSON assigned to the subscription. Enables the subscriber to define the message delivery retry strategy in the case of an HTTP/S endpoint subscribed to the topic.
regionstringFor cross-region subscriptions, the region in which the topic resides.If no region is specified, AWS CloudFormation uses the region of the caller as the default.
subscription_role_arnstringThis property applies only to Amazon Data Firehose delivery stream subscriptions.
filter_policy_scopestringThis attribute lets you choose the filtering scope by using one of the following string value types: MessageAttributes (default) and MessageBody.
protocolstringThe subscription's protocol.
regionstringAWS region.

For more information, see AWS::SNS::Subscription.

Methods

NameResourceAccessible byRequired Params
create_resourcesubscriptionsINSERTTopicArn, Protocol, region
delete_resourcesubscriptionsDELETEIdentifier, region
update_resourcesubscriptionsUPDATEIdentifier, PatchDocument, region
list_resourcessubscriptions_list_onlySELECTregion
get_resourcesubscriptionsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual subscription.

SELECT
region,
arn,
replay_policy,
raw_message_delivery,
endpoint,
filter_policy,
topic_arn,
redrive_policy,
delivery_policy,
region,
subscription_role_arn,
filter_policy_scope,
protocol
FROM awscc.sns.subscriptions
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';

INSERT example

Use the following StackQL query and manifest file to create a new subscription resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.sns.subscriptions (
TopicArn,
Protocol,
region
)
SELECT
'{{ topic_arn }}',
'{{ protocol }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a subscription resource, using stack-deploy.

/*+ update */
UPDATE awscc.sns.subscriptions
SET PatchDocument = string('{{ {
"ReplayPolicy": replay_policy,
"RawMessageDelivery": raw_message_delivery,
"FilterPolicy": filter_policy,
"RedrivePolicy": redrive_policy,
"DeliveryPolicy": delivery_policy,
"Region": region,
"SubscriptionRoleArn": subscription_role_arn,
"FilterPolicyScope": filter_policy_scope
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.sns.subscriptions
WHERE
Identifier = '{{ arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the subscriptions resource, the following permissions are required:

iam:GetRole,
iam:PassRole,
sns:Subscribe