Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
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.
Skenario adalah contoh kode yang menunjukkan kepada Anda bagaimana menyelesaikan tugas tertentu dengan memanggil beberapa fungsi dalam layanan atau dikombinasikan 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakancheck-if-phone-number-is-opted-out.
- AWS CLI
-
Untuk memeriksa pesan SMS opt-out untuk nomor telepon
check-if-phone-number-is-opted-outContoh berikut memeriksa apakah nomor telepon yang ditentukan dipilih untuk 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanconfirm-subscription.
- AWS CLI
-
Untuk mengonfirmasi langganan
confirm-subscriptionPerintah berikut menyelesaikan proses konfirmasi yang dimulai saat Anda berlangganan topik SNS bernama.my-topicParameter --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 Referensi AWS CLI 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 Referensi AWS CLI 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 Baris AWS Perintah dengan Amazon SQS dan Amazon SNS di Panduan Pengguna Antarmuka Baris AWS Perintah.
-
Untuk detail API, lihat CreateTopic
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakandelete-endpoint.
- AWS CLI
-
Untuk menghapus titik akhir aplikasi platform
delete-endpointContoh berikut menghapus endpoint 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 Referensi AWS CLI 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 Referensi AWS CLI 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-endpoint-attributes.
- AWS CLI
-
Untuk membuat daftar atribut endpoint aplikasi platform
get-endpoint-attributesContoh berikut mencantumkan atribut untuk endpoint aplikasi platform tertentu.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 Referensi AWS CLI 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 Referensi AWS CLI 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 Dapatkan SMSAttributes
Referensi AWS CLI Perintah.
-
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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanget-topic-attributes.
- AWS CLI
-
Untuk mengambil atribut dari suatu 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 Referensi AWS CLI 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 endpoint 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-phone-numbers-opted-out.
- AWS CLI
-
Untuk membuat daftar opt-out pesan SMS
list-phone-numbers-opted-outContoh berikut mencantumkan nomor telepon yang dipilih untuk tidak menerima pesan SMS.aws sns list-phone-numbers-opted-outOutput:
{ "phoneNumbers": [ "+15555550100" ] }-
Untuk detail API, lihat ListPhoneNumbersOptedOut
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-platform-applications.
- AWS CLI
-
Untuk membuat 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 Referensi AWS CLI 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-subscriptions.
- AWS CLI
-
Untuk membuat daftar langganan SNS Anda
list-subscriptionsContoh berikut menampilkan daftar langganan SNS di akun Anda AWS .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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.
- AWS CLI
-
Untuk mencantumkan tag untuk suatu 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanlist-topics.
- AWS CLI
-
Untuk membuat daftar 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanopt-in-phone-number.
- AWS CLI
-
Untuk ikut serta dalam 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanpublish.
- AWS CLI
-
Contoh 1: Untuk 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: Untuk mempublikasikan pesan SMS ke nomor telepon
publishContoh berikut menerbitkan pesanHello world!ke nomor+1-555-555-0100telepon.aws sns publish \ --message"Hello world!"\ --phone-number+1-555-555-0100Output:
{ "MessageId": "123a45b6-7890-12c3-45d6-333322221111" }-
Untuk detail API, lihat Menerbitkan
di Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanput-data-protection-policy.
- AWS CLI
-
Untuk menetapkan kebijakan perlindungan data
Contoh 1: Untuk menolak penerbit mempublikasikan pesan dengan CreditCardNumber
put-data-protection-policyContoh berikut menyangkal penerbit dari mempublikasikan pesan dengan. CreditCardNumberaws 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanremove-permission.
- AWS CLI
-
Untuk menghapus izin dari suatu 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-endpoint-attributes.
- AWS CLI
-
Untuk mengatur atribut titik akhir
set-endpoint-attributesContoh berikut menonaktifkan endpoint 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 Referensi AWS CLI 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 yang ditentukan 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 Referensi AWS CLI 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 Menyetel SMSAttributes
di Referensi AWS CLI Perintah.
-
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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanset-topic-attributes.
- AWS CLI
-
Untuk menetapkan 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakansubscribe.
- AWS CLI
-
Untuk berlangganan topik
subscribePerintah 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 Berlangganan
di Referensi AWS CLI 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 Referensi AWS CLI Perintah.
-
Contoh kode berikut menunjukkan cara menggunakanunsubscribe.
- AWS CLI
-
Untuk berhenti berlangganan dari suatu topik
unsubscribeContoh berikut menghapus langganan yang ditentukan dari suatu 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 berlangganan
di Referensi AWS CLI 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 Referensi AWS CLI Perintah.
-
Skenario
Contoh kode berikut menunjukkan cara membuat titik akhir platform untuk notifikasi push Amazon SNS.
- AWS CLI
-
Untuk membuat endpoint 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" }