Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Contoh Amazon SNS menggunakan AWS CLI
Contoh kode berikut menunjukkan cara melakukan tindakan dan menerapkan skenario umum dengan menggunakan AWS Command Line Interface dengan Amazon SNS.
Tindakan merupakan kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.
S kenario adalah contoh kode yang menunjukkan cara menyelesaikan tugas tertentu dengan memanggil beberapa fungsi dalam layanan atau digabungkan dengan yang lain Layanan AWS.
Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.
Tindakan
Contoh kode berikut menunjukkan cara menggunakanadd-permission.
- AWS CLI
-
Untuk menambahkan izin ke topik
add-permissionContoh berikut menambahkan izin untuk AWS akun987654321098untuk menggunakanPublishtindakan dengan topik yang ditentukan di bawah AWS akun123456789012.aws sns add-permission \ --topic-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --labelPublish-Permission\ --aws-account-id987654321098\ --action-namePublishPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat AddPermission
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancheck-if-phone-number-is-opted-out.
- AWS CLI
-
Untuk memeriksa pesan SMS, pilih keluar untuk nomor telepon
check-if-phone-number-is-opted-outContoh berikut memeriksa apakah nomor telepon yang ditentukan tidak menerima pesan SMS dari AWS akun saat ini.aws sns check-if-phone-number-is-opted-out \ --phone-number+1555550100Output:
{ "isOptedOut": false }-
Untuk detail API, lihat CheckIfPhoneNumberIsOptedOut
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanconfirm-subscription.
- AWS CLI
-
Untuk mengonfirmasi langganan
Per
confirm-subscriptionintah berikut menyelesaikan proses konfirmasi yang dimulai saat Anda berlangganan topik SNS bernamamy-topic. Parameter --token berasal dari pesan konfirmasi yang dikirim ke titik akhir notifikasi yang ditentukan dalam panggilan berlangganan.aws sns confirm-subscription \ --topic-arnarn:aws:sns:us-west-2:123456789012:my-topic\ --token2336412f37fb687f5d51e6e241d7700ae02f7124d8268910b858cb4db727ceeb2474bb937929d3bdd7ce5d0cce19325d036bc858d3c217426bcafa9c501a2cace93b83f1dd3797627467553dc438a8c974119496fc3eff026eaa5d14472ded6f9a5c43aec62d83ef5f49109da7176391Output:
{ "SubscriptionArn": "arn:aws:sns:us-west-2:123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f" }-
Untuk detail API, lihat ConfirmSubscription
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-platform-application.
- AWS CLI
-
Untuk membuat aplikasi platform
create-platform-applicationContoh berikut membuat aplikasi platform Google Firebase menggunakan kredensi platform yang ditentukan.aws sns create-platform-application \ --nameMyApplication\ --platformGCM\ --attributesPlatformCredential=EXAMPLEabcd12345jklm67890stuv12345bcdefOutput:
{ "PlatformApplicationArn": "arn:aws:sns:us-west-2:123456789012:app/GCM/MyApplication" }-
Untuk detail API, lihat CreatePlatformApplication
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancreate-topic.
- AWS CLI
-
Untuk membuat topik SNS
create-topicContoh berikut membuat topik SNS bernamamy-topic.aws sns create-topic \ --namemy-topicOutput:
{ "ResponseMetadata": { "RequestId": "1469e8d7-1642-564e-b85d-a19b4b341f83" }, "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic" }Untuk informasi selengkapnya, lihat Menggunakan Antarmuka AWS Baris Perintah dengan Amazon SQS dan Amazon SNS di Panduan Pengguna Antarmuka AWS Baris Perintah.
-
Untuk detail API, lihat CreateTopic
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-endpoint.
- AWS CLI
-
Untuk menghapus titik akhir aplikasi platform
delete-endpointContoh berikut menghapus titik akhir aplikasi platform yang ditentukan.aws sns delete-endpoint \ --endpoint-arnarn:aws:sns:us-west-2:123456789012:endpoint/GCM/MyApplication/12345678-abcd-9012-efgh-345678901234Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat DeleteEndpoint
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-platform-application.
- AWS CLI
-
Untuk menghapus aplikasi platform
delete-platform-applicationContoh berikut menghapus aplikasi platform yang ditentukan.aws sns delete-platform-application \ --platform-application-arnarn:aws:sns:us-west-2:123456789012:app/ADM/MyApplicationPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat DeletePlatformApplication
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-topic.
- AWS CLI
-
Untuk menghapus topik SNS
delete-topicContoh berikut menghapus topik SNS yang ditentukan.aws sns delete-topic \ --topic-arn"arn:aws:sns:us-west-2:123456789012:my-topic"Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat DeleteTopic
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-endpoint-attributes.
- AWS CLI
-
Untuk membuat daftar atribut titik akhir aplikasi platform
get-endpoint-attributesContoh berikut mencantumkan atribut untuk titik akhir aplikasi platform yang ditentukan.aws sns get-endpoint-attributes \ --endpoint-arnarn:aws:sns:us-west-2:123456789012:endpoint/GCM/MyApplication/12345678-abcd-9012-efgh-345678901234Output:
{ "Attributes": { "Enabled": "true", "Token": "EXAMPLE12345..." } }-
Untuk detail API, lihat GetEndpointAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-platform-application-attributes.
- AWS CLI
-
Untuk membuat daftar atribut aplikasi platform
get-platform-application-attributesContoh berikut mencantumkan atribut untuk aplikasi platform tertentu.aws sns get-platform-application-attributes \ --platform-application-arnarn:aws:sns:us-west-2:123456789012:app/MPNS/MyApplicationOutput:
{ "Attributes": { "Enabled": "true", "SuccessFeedbackSampleRate": "100" } }-
Untuk detail API, lihat GetPlatformApplicationAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-sms-attributes.
- AWS CLI
-
Untuk mencantumkan atribut pesan SMS default
get-sms-attributesContoh berikut mencantumkan atribut default untuk mengirim pesan SMS.aws sns get-sms-attributesOutput:
{ "attributes": { "DefaultSenderID": "MyName" } }-
Untuk detail API, lihat GetSMSAttributes di Referensi Perintah
. AWS CLI
-
Contoh kode berikut menunjukkan cara menggunakanget-subscription-attributes.
- AWS CLI
-
Untuk mengambil atribut langganan untuk topik
Berikut ini
get-subscription-attributesmenampilkan atribut langganan yang ditentukan. Anda bisa mendapatkansubscription-arndari outputlist-subscriptionsperintah.aws sns get-subscription-attributes \ --subscription-arn"arn:aws:sns:us-west-2:123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f"Output:
{ "Attributes": { "Endpoint": "my-email@example.com", "Protocol": "email", "RawMessageDelivery": "false", "ConfirmationWasAuthenticated": "false", "Owner": "123456789012", "SubscriptionArn": "arn:aws:sns:us-west-2:123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f", "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic" } }-
Untuk detail API, lihat GetSubscriptionAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-topic-attributes.
- AWS CLI
-
Untuk mengambil atribut topik
get-topic-attributesContoh berikut menampilkan atribut untuk topik yang ditentukan.aws sns get-topic-attributes \ --topic-arn"arn:aws:sns:us-west-2:123456789012:my-topic"Output:
{ "Attributes": { "SubscriptionsConfirmed": "1", "DisplayName": "my-topic", "SubscriptionsDeleted": "0", "EffectiveDeliveryPolicy": "{\"http\":{\"defaultHealthyRetryPolicy\":{\"minDelayTarget\":20,\"maxDelayTarget\":20,\"numRetries\":3,\"numMaxDelayRetries\":0,\"numNoDelayRetries\":0,\"numMinDelayRetries\":0,\"backoffFunction\":\"linear\"},\"disableSubscriptionOverrides\":false}}", "Owner": "123456789012", "Policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:Subscribe\",\"SNS:ListSubscriptionsByTopic\",\"SNS:DeleteTopic\",\"SNS:GetTopicAttributes\",\"SNS:Publish\",\"SNS:RemovePermission\",\"SNS:AddPermission\",\"SNS:SetTopicAttributes\"],\"Resource\":\"arn:aws:sns:us-west-2:123456789012:my-topic\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"0123456789012\"}}}]}", "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic", "SubscriptionsPending": "0" } }-
Untuk detail API, lihat GetTopicAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-endpoints-by-platform-application.
- AWS CLI
-
Untuk membuat daftar titik akhir untuk aplikasi platform
list-endpoints-by-platform-applicationContoh berikut mencantumkan titik akhir dan atribut titik akhir untuk aplikasi platform tertentu.aws sns list-endpoints-by-platform-application \ --platform-application-arnarn:aws:sns:us-west-2:123456789012:app/GCM/MyApplicationOutput:
{ "Endpoints": [ { "Attributes": { "Token": "EXAMPLE12345..., "Enabled": "true" }, "EndpointArn": "arn:aws:sns:us-west-2:123456789012:endpoint/GCM/MyApplication/12345678-abcd-9012-efgh-345678901234" } ] }-
Untuk detail API, lihat ListEndpointsByPlatformApplication
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-phone-numbers-opted-out.
- AWS CLI
-
Untuk mencantumkan pilihan keluar pesan SMS
list-phone-numbers-opted-outContoh berikut mencantumkan nomor telepon yang memilih untuk tidak menerima pesan SMS.aws sns list-phone-numbers-opted-outOutput:
{ "phoneNumbers": [ "+15555550100" ] }-
Untuk detail API, lihat ListPhoneNumbersOptedOut
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-platform-applications.
- AWS CLI
-
Untuk daftar aplikasi platform
list-platform-applicationsContoh berikut mencantumkan aplikasi platform untuk ADM dan MPNS.aws sns list-platform-applicationsOutput:
{ "PlatformApplications": [ { "PlatformApplicationArn": "arn:aws:sns:us-west-2:123456789012:app/ADM/MyApplication", "Attributes": { "SuccessFeedbackSampleRate": "100", "Enabled": "true" } }, { "PlatformApplicationArn": "arn:aws:sns:us-west-2:123456789012:app/MPNS/MyOtherApplication", "Attributes": { "SuccessFeedbackSampleRate": "100", "Enabled": "true" } } ] }-
Untuk detail API, lihat ListPlatformApplications
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-subscriptions-by-topic.
- AWS CLI
-
Untuk membuat daftar langganan yang terkait dengan topik
Berikut ini
list-subscriptions-by-topicmengambil daftar langganan SNS yang terkait dengan topik yang ditentukan.aws sns list-subscriptions-by-topic \ --topic-arn"arn:aws:sns:us-west-2:123456789012:my-topic"Output:
{ "Subscriptions": [ { "Owner": "123456789012", "Endpoint": "my-email@example.com", "Protocol": "email", "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic", "SubscriptionArn": "arn:aws:sns:us-west-2:123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f" } ] }-
Untuk detail API, lihat ListSubscriptionsByTopic
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-subscriptions.
- AWS CLI
-
Untuk mencantumkan langganan SNS Anda
list-subscriptionsContoh berikut menampilkan daftar langganan SNS di AWS akun Anda.aws sns list-subscriptionsOutput:
{ "Subscriptions": [ { "Owner": "123456789012", "Endpoint": "my-email@example.com", "Protocol": "email", "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic", "SubscriptionArn": "arn:aws:sns:us-west-2:123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f" } ] }-
Untuk detail API, lihat ListSubscriptions
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.
- AWS CLI
-
Untuk mencantumkan tag untuk topik
list-tags-for-resourceContoh berikut mencantumkan tag untuk topik Amazon SNS yang ditentukan.aws sns list-tags-for-resource \ --resource-arnarn:aws:sns:us-west-2:123456789012:MyTopicOutput:
{ "Tags": [ { "Key": "Team", "Value": "Alpha" } ] }-
Untuk detail API, lihat ListTagsForResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-topics.
- AWS CLI
-
Untuk mencantumkan topik SNS Anda
list-topicsContoh berikut mencantumkan semua topik SNS di AWS akun Anda.aws sns list-topicsOutput:
{ "Topics": [ { "TopicArn": "arn:aws:sns:us-west-2:123456789012:my-topic" } ] }-
Untuk detail API, lihat ListTopics
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanopt-in-phone-number.
- AWS CLI
-
Cara memilih untuk menerima pesan SMS
opt-in-phone-numberContoh berikut memilih nomor telepon yang ditentukan untuk menerima pesan SMS.aws sns opt-in-phone-number \ --phone-number+15555550100Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat OptInPhoneNumber
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanpublish.
- AWS CLI
-
Contoh 1: Mempublikasikan pesan ke topik
publishContoh berikut menerbitkan pesan yang ditentukan ke topik SNS yang ditentukan. Pesan berasal dari file teks, yang memungkinkan Anda untuk memasukkan jeda baris.aws sns publish \ --topic-arn"arn:aws:sns:us-west-2:123456789012:my-topic"\ --messagefile://message.txtIsi dari
message.txt:Hello World Second LineOutput:
{ "MessageId": "123a45b6-7890-12c3-45d6-111122223333" }Contoh 2: Mempublikasikan pesan SMS ke nomor telepon
publishContoh berikut menerbitkan pesanHello world!ke nomor telepon+1-555-555-0100.aws sns publish \ --message"Hello world!"\ --phone-number+1-555-555-0100Output:
{ "MessageId": "123a45b6-7890-12c3-45d6-333322221111" }-
Untuk detail API, lihat Publi kasikan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-data-protection-policy.
- AWS CLI
-
Untuk mengatur kebijakan perlindungan data
Contoh 1: Untuk menolak penerbit menerbitkan pesan dengan CreditCardNumber
put-data-protection-policyContoh berikut menolak penerbit menerbitkan pesan dengan CreditCardNumber.aws sns put-data-protection-policy \ --resource-arnarn:aws:sns:us-east-1:123456789012:mytopic\ --data-protection-policy "{\"Name\":\"data_protection_policy\",\"Description\":\"Example data protection policy\",\"Version\":\"2021-06-01\",\"Statement\":[{\"DataDirection\":\"Inbound\",\"Principal\":[\"*\"],\"DataIdentifier\":[\"arn:aws:dataprotection::aws:data-identifier/CreditCardNumber\"],\"Operation\":{\"Deny\":{}}}]}"Perintah ini tidak menghasilkan output.
Contoh 2: Untuk memuat parameter dari file
Berikut ini
put-data-protection-policymemuat parameter dari file.aws sns put-data-protection-policy \ --resource-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --data-protection-policyfile://policy.jsonPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat PutDataProtectionPolicy
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanremove-permission.
- AWS CLI
-
Untuk menghapus izin dari topik
remove-permissionContoh berikut menghapus izinPublish-Permissiondari topik yang ditentukan.aws sns remove-permission \ --topic-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --labelPublish-PermissionPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat RemovePermission
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-endpoint-attributes.
- AWS CLI
-
Untuk menyetel atribut titik akhir
set-endpoint-attributesContoh berikut menonaktifkan titik akhir aplikasi platform yang ditentukan.aws sns set-endpoint-attributes \ --endpoint-arnarn:aws:sns:us-west-2:123456789012:endpoint/GCM/MyApplication/12345678-abcd-9012-efgh-345678901234\ --attributesEnabled=falseOutput:
{ "Attributes": { "Enabled": "false", "Token": "EXAMPLE12345..." } }-
Untuk detail API, lihat SetEndpointAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-platform-application-attributes.
- AWS CLI
-
Untuk mengatur atribut aplikasi platform
set-platform-application-attributesContoh berikut menetapkanEventDeliveryFailureatribut untuk aplikasi platform tertentu ke ARN dari topik Amazon SNS yang ditentukan.aws sns set-platform-application-attributes \ --platform-application-arnarn:aws:sns:us-west-2:123456789012:app/GCM/MyApplication\ --attributesEventDeliveryFailure=arn:aws:sns:us-west-2:123456789012:AnotherTopicPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat SetPlatformApplicationAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-sms-attributes.
- AWS CLI
-
Untuk mengatur atribut pesan SMS
set-sms-attributesContoh berikut menetapkan ID pengirim default untuk pesan SMS keMyName.aws sns set-sms-attributes \ --attributesDefaultSenderID=MyNamePerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat SetSMSAttributes di Referensi Perintah
. AWS CLI
-
Contoh kode berikut menunjukkan cara menggunakanset-subscription-attributes.
- AWS CLI
-
Untuk mengatur atribut langganan
set-subscription-attributesContoh berikut menetapkanRawMessageDeliveryatribut ke langganan SQS.aws sns set-subscription-attributes \ --subscription-arnarn:aws:sns:us-east-1:123456789012:mytopic:f248de18-2cf6-578c-8592-b6f1eaa877dc\ --attribute-nameRawMessageDelivery\ --attribute-valuetruePerintah ini tidak menghasilkan output.
set-subscription-attributesContoh berikut menetapkanFilterPolicyatribut ke langganan SQS.aws sns set-subscription-attributes \ --subscription-arnarn:aws:sns:us-east-1:123456789012:mytopic:f248de18-2cf6-578c-8592-b6f1eaa877dc\ --attribute-nameFilterPolicy\ --attribute-value "{ \"anyMandatoryKey\": [\"any\", \"of\", \"these\"] }"Perintah ini tidak menghasilkan output.
set-subscription-attributesContoh berikut menghapusFilterPolicyatribut dari langganan SQS.aws sns set-subscription-attributes \ --subscription-arnarn:aws:sns:us-east-1:123456789012:mytopic:f248de18-2cf6-578c-8592-b6f1eaa877dc\ --attribute-nameFilterPolicy\ --attribute-value"{}"Perintah ini tidak menghasilkan output.
-
Untuk detail API, lihat SetSubscriptionAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-topic-attributes.
- AWS CLI
-
Untuk mengatur atribut untuk topik
set-topic-attributesContoh berikut menetapkanDisplayNameatribut untuk topik yang ditentukan.aws sns set-topic-attributes \ --topic-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --attribute-nameDisplayName\ --attribute-valueMyTopicDisplayNamePerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat SetTopicAttributes
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakansubscribe.
- AWS CLI
-
Untuk berlangganan topik
Per
subscribeintah berikut berlangganan alamat email ke topik yang ditentukan.aws sns subscribe \ --topic-arnarn:aws:sns:us-west-2:123456789012:my-topic\ --protocolemail\ --notification-endpointmy-email@example.comOutput:
{ "SubscriptionArn": "pending confirmation" }-
Untuk detail API, lihat Ber langganan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakantag-resource.
- AWS CLI
-
Untuk menambahkan tag ke topik
tag-resourceContoh berikut menambahkan tag metadata ke topik Amazon SNS yang ditentukan.aws sns tag-resource \ --resource-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --tagsKey=Team,Value=AlphaPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat TagResource
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanunsubscribe.
- AWS CLI
-
Untuk berhenti berlangganan dari topik
unsubscribeContoh berikut menghapus langganan yang ditentukan dari topik.aws sns unsubscribe \ --subscription-arnarn:aws:sns:us-west-2:0123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7fPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat Berhenti Berhenti Berlangganan
di Refer AWS CLI ensi Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanuntag-resource.
- AWS CLI
-
Untuk menghapus tag dari topik
untag-resourceContoh berikut menghapus tag apa pun dengan kunci yang ditentukan dari topik Amazon SNS yang ditentukan.aws sns untag-resource \ --resource-arnarn:aws:sns:us-west-2:123456789012:MyTopic\ --tag-keysTeamPerintah ini tidak menghasilkan output.
-
Untuk detail API, lihat UntagResource
di Refer AWS CLI ensi Perintah.
-
Skenario
Contoh kode berikut menunjukkan cara membuat titik akhir platform untuk pemberitahuan push Amazon SNS.
- AWS CLI
-
Untuk membuat titik akhir aplikasi platform
create-platform-endpointContoh berikut membuat titik akhir untuk aplikasi platform tertentu menggunakan token yang ditentukan.aws sns create-platform-endpoint \ --platform-application-arnarn:aws:sns:us-west-2:123456789012:app/GCM/MyApplication\ --tokenEXAMPLE12345...Output:
{ "EndpointArn": "arn:aws:sns:us-west-2:1234567890:endpoint/GCM/MyApplication/12345678-abcd-9012-efgh-345678901234" }