Tutorial: Removing a subscription filter policy - Amazon Simple Notification Service

Tutorial: Removing a subscription filter policy

To stop filtering the messages that are sent to a subscription, remove the subscription's filter policy by overwriting it with an empty JSON body. After you remove the policy, the subscription accepts every message that's published to it.

AWS Management Console

  1. Sign in to the Amazon SNS console.

  2. On the navigation panel, choose Subscriptions.

  3. Select a subscription and then choose Edit.

  4. On the Edit EXAMPLE1-23bc-4567-d890-ef12g3hij456 page, expand the Subscription filter policy section.

  5. In the JSON editor field, provide an empty JSON body for your filter policy: {}.

  6. Choose Save changes.

    Amazon SNS applies your filter policy to the subscription.

AWS CLI

To remove a filter policy with the AWS CLI, use the set-subscription-attributes command and provide an empty JSON body for the --attribute-value argument:

$ aws sns set-subscription-attributes --subscription-arn arn:aws:sns: ... --attribute-name FilterPolicy --attribute-value "{}"

AWS SDK for Java

The following examples show how to remove filter policies using the Amazon SNS clients that are provided by the AWS SDKs.

AWS SDK for Java

To remove a filter policy with the AWS SDK for Java, use the setSubscriptionAttributes method of the AmazonSNS client. Provide a string that contains an empty JSON body as your filter policy:

AmazonSNS snsClient = AmazonSNSClientBuilder.defaultClient(); SetSubscriptionAttributesRequest request = new SetSubscriptionAttributesRequest(subscriptionArn, "FilterPolicy", "{}"); snsClient.setSubscriptionAttributes(request);
AWS SDK for .NET

To remove a filter policy with the AWS SDK for .NET, use the SetSubscriptionAttributes method of the AmazonSNS client. Provide a string that contains an empty JSON body as your filter policy:

AmazonSimpleNotificationServiceClient snsClient = new AmazonSimpleNotificationServiceClient(); SetSubscriptionAttributesRequest request = new SetSubscriptionAttributesRequest(subscriptionArn, "FilterPolicy", "{}"); snsClient.SetSubscriptionAttributes(request);

Amazon SNS API

To remove a filter policy with the Amazon SNS API, make a request to the SetSubscriptionAttributes action. Set the AttributeName parameter to FilterPolicy, and provide an empty JSON body for the AttributeValue parameter.