subscriptions
Creates, updates, deletes or gets a subscription resource or lists subscriptions in a region
Overview
| Name | subscriptions |
| Type | Resource |
| Description | Resource Type definition for AWS::SNS::Subscription |
| Id | awscc.sns.subscriptions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | Arn of the subscription |
replay_policy | object | Specifies whether Amazon SNS resends the notification to the subscription when a message's attribute changes. |
raw_message_delivery | boolean | When 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. |
endpoint | string | The subscription's endpoint. The endpoint value depends on the protocol that you specify. |
filter_policy | object | The filter policy JSON assigned to the subscription. Enables the subscriber to filter out unwanted messages. |
topic_arn | string | The ARN of the topic to subscribe to. |
redrive_policy | object | When 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_policy | object | The 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. |
region | string | For 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_arn | string | This property applies only to Amazon Data Firehose delivery stream subscriptions. |
filter_policy_scope | string | This attribute lets you choose the filtering scope by using one of the following string value types: MessageAttributes (default) and MessageBody. |
protocol | string | The subscription's protocol. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | Arn of the subscription |
region | string | For 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. |
region | string | AWS region. |
For more information, see AWS::SNS::Subscription.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | subscriptions | INSERT | TopicArn, Protocol, region |
delete_resource | subscriptions | DELETE | Identifier, region |
update_resource | subscriptions | UPDATE | Identifier, PatchDocument, region |
list_resources | subscriptions_list_only | SELECT | region |
get_resource | subscriptions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 }}';
Lists all subscriptions in a region.
SELECT
region,
arn
FROM awscc.sns.subscriptions_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new subscription resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ 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
;
/*+ create */
INSERT INTO awscc.sns.subscriptions (
ReplayPolicy,
RawMessageDelivery,
Endpoint,
FilterPolicy,
TopicArn,
RedrivePolicy,
DeliveryPolicy,
Region,
SubscriptionRoleArn,
FilterPolicyScope,
Protocol,
region
)
SELECT
'{{ replay_policy }}',
'{{ raw_message_delivery }}',
'{{ endpoint }}',
'{{ filter_policy }}',
'{{ topic_arn }}',
'{{ redrive_policy }}',
'{{ delivery_policy }}',
'{{ region }}',
'{{ subscription_role_arn }}',
'{{ filter_policy_scope }}',
'{{ protocol }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: subscription
props:
- name: replay_policy
value: {}
- name: raw_message_delivery
value: '{{ raw_message_delivery }}'
- name: endpoint
value: '{{ endpoint }}'
- name: filter_policy
value: {}
- name: topic_arn
value: '{{ topic_arn }}'
- name: redrive_policy
value: {}
- name: delivery_policy
value: {}
- name: region
value: '{{ region }}'
- name: subscription_role_arn
value: '{{ subscription_role_arn }}'
- name: filter_policy_scope
value: '{{ filter_policy_scope }}'
- name: protocol
value: '{{ protocol }}'
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:
| Parameter | Description |
|---|---|
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:
- Create
- Read
- Update
- Delete
- List
iam:GetRole,
iam:PassRole,
sns:Subscribe
sns:GetSubscriptionAttributes
iam:GetRole,
iam:PassRole,
sns:SetSubscriptionAttributes
sns:Unsubscribe,
sns:GetSubscriptionAttributes
sns:ListSubscriptions