examples_test.go 120 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ec2_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/ec2"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleEC2_AcceptVpcPeeringConnection() {
  13. svc := ec2.New(nil)
  14. params := &ec2.AcceptVpcPeeringConnectionInput{
  15. DryRun: aws.Bool(true),
  16. VpcPeeringConnectionId: aws.String("String"),
  17. }
  18. resp, err := svc.AcceptVpcPeeringConnection(params)
  19. if err != nil {
  20. // Print the error, cast err to awserr.Error to get the Code and
  21. // Message from an error.
  22. fmt.Println(err.Error())
  23. return
  24. }
  25. // Pretty-print the response data.
  26. fmt.Println(resp)
  27. }
  28. func ExampleEC2_AllocateAddress() {
  29. svc := ec2.New(nil)
  30. params := &ec2.AllocateAddressInput{
  31. Domain: aws.String("DomainType"),
  32. DryRun: aws.Bool(true),
  33. }
  34. resp, err := svc.AllocateAddress(params)
  35. if err != nil {
  36. // Print the error, cast err to awserr.Error to get the Code and
  37. // Message from an error.
  38. fmt.Println(err.Error())
  39. return
  40. }
  41. // Pretty-print the response data.
  42. fmt.Println(resp)
  43. }
  44. func ExampleEC2_AssignPrivateIpAddresses() {
  45. svc := ec2.New(nil)
  46. params := &ec2.AssignPrivateIpAddressesInput{
  47. NetworkInterfaceId: aws.String("String"), // Required
  48. AllowReassignment: aws.Bool(true),
  49. PrivateIpAddresses: []*string{
  50. aws.String("String"), // Required
  51. // More values...
  52. },
  53. SecondaryPrivateIpAddressCount: aws.Int64(1),
  54. }
  55. resp, err := svc.AssignPrivateIpAddresses(params)
  56. if err != nil {
  57. // Print the error, cast err to awserr.Error to get the Code and
  58. // Message from an error.
  59. fmt.Println(err.Error())
  60. return
  61. }
  62. // Pretty-print the response data.
  63. fmt.Println(resp)
  64. }
  65. func ExampleEC2_AssociateAddress() {
  66. svc := ec2.New(nil)
  67. params := &ec2.AssociateAddressInput{
  68. AllocationId: aws.String("String"),
  69. AllowReassociation: aws.Bool(true),
  70. DryRun: aws.Bool(true),
  71. InstanceId: aws.String("String"),
  72. NetworkInterfaceId: aws.String("String"),
  73. PrivateIpAddress: aws.String("String"),
  74. PublicIp: aws.String("String"),
  75. }
  76. resp, err := svc.AssociateAddress(params)
  77. if err != nil {
  78. // Print the error, cast err to awserr.Error to get the Code and
  79. // Message from an error.
  80. fmt.Println(err.Error())
  81. return
  82. }
  83. // Pretty-print the response data.
  84. fmt.Println(resp)
  85. }
  86. func ExampleEC2_AssociateDhcpOptions() {
  87. svc := ec2.New(nil)
  88. params := &ec2.AssociateDhcpOptionsInput{
  89. DhcpOptionsId: aws.String("String"), // Required
  90. VpcId: aws.String("String"), // Required
  91. DryRun: aws.Bool(true),
  92. }
  93. resp, err := svc.AssociateDhcpOptions(params)
  94. if err != nil {
  95. // Print the error, cast err to awserr.Error to get the Code and
  96. // Message from an error.
  97. fmt.Println(err.Error())
  98. return
  99. }
  100. // Pretty-print the response data.
  101. fmt.Println(resp)
  102. }
  103. func ExampleEC2_AssociateRouteTable() {
  104. svc := ec2.New(nil)
  105. params := &ec2.AssociateRouteTableInput{
  106. RouteTableId: aws.String("String"), // Required
  107. SubnetId: aws.String("String"), // Required
  108. DryRun: aws.Bool(true),
  109. }
  110. resp, err := svc.AssociateRouteTable(params)
  111. if err != nil {
  112. // Print the error, cast err to awserr.Error to get the Code and
  113. // Message from an error.
  114. fmt.Println(err.Error())
  115. return
  116. }
  117. // Pretty-print the response data.
  118. fmt.Println(resp)
  119. }
  120. func ExampleEC2_AttachClassicLinkVpc() {
  121. svc := ec2.New(nil)
  122. params := &ec2.AttachClassicLinkVpcInput{
  123. Groups: []*string{ // Required
  124. aws.String("String"), // Required
  125. // More values...
  126. },
  127. InstanceId: aws.String("String"), // Required
  128. VpcId: aws.String("String"), // Required
  129. DryRun: aws.Bool(true),
  130. }
  131. resp, err := svc.AttachClassicLinkVpc(params)
  132. if err != nil {
  133. // Print the error, cast err to awserr.Error to get the Code and
  134. // Message from an error.
  135. fmt.Println(err.Error())
  136. return
  137. }
  138. // Pretty-print the response data.
  139. fmt.Println(resp)
  140. }
  141. func ExampleEC2_AttachInternetGateway() {
  142. svc := ec2.New(nil)
  143. params := &ec2.AttachInternetGatewayInput{
  144. InternetGatewayId: aws.String("String"), // Required
  145. VpcId: aws.String("String"), // Required
  146. DryRun: aws.Bool(true),
  147. }
  148. resp, err := svc.AttachInternetGateway(params)
  149. if err != nil {
  150. // Print the error, cast err to awserr.Error to get the Code and
  151. // Message from an error.
  152. fmt.Println(err.Error())
  153. return
  154. }
  155. // Pretty-print the response data.
  156. fmt.Println(resp)
  157. }
  158. func ExampleEC2_AttachNetworkInterface() {
  159. svc := ec2.New(nil)
  160. params := &ec2.AttachNetworkInterfaceInput{
  161. DeviceIndex: aws.Int64(1), // Required
  162. InstanceId: aws.String("String"), // Required
  163. NetworkInterfaceId: aws.String("String"), // Required
  164. DryRun: aws.Bool(true),
  165. }
  166. resp, err := svc.AttachNetworkInterface(params)
  167. if err != nil {
  168. // Print the error, cast err to awserr.Error to get the Code and
  169. // Message from an error.
  170. fmt.Println(err.Error())
  171. return
  172. }
  173. // Pretty-print the response data.
  174. fmt.Println(resp)
  175. }
  176. func ExampleEC2_AttachVolume() {
  177. svc := ec2.New(nil)
  178. params := &ec2.AttachVolumeInput{
  179. Device: aws.String("String"), // Required
  180. InstanceId: aws.String("String"), // Required
  181. VolumeId: aws.String("String"), // Required
  182. DryRun: aws.Bool(true),
  183. }
  184. resp, err := svc.AttachVolume(params)
  185. if err != nil {
  186. // Print the error, cast err to awserr.Error to get the Code and
  187. // Message from an error.
  188. fmt.Println(err.Error())
  189. return
  190. }
  191. // Pretty-print the response data.
  192. fmt.Println(resp)
  193. }
  194. func ExampleEC2_AttachVpnGateway() {
  195. svc := ec2.New(nil)
  196. params := &ec2.AttachVpnGatewayInput{
  197. VpcId: aws.String("String"), // Required
  198. VpnGatewayId: aws.String("String"), // Required
  199. DryRun: aws.Bool(true),
  200. }
  201. resp, err := svc.AttachVpnGateway(params)
  202. if err != nil {
  203. // Print the error, cast err to awserr.Error to get the Code and
  204. // Message from an error.
  205. fmt.Println(err.Error())
  206. return
  207. }
  208. // Pretty-print the response data.
  209. fmt.Println(resp)
  210. }
  211. func ExampleEC2_AuthorizeSecurityGroupEgress() {
  212. svc := ec2.New(nil)
  213. params := &ec2.AuthorizeSecurityGroupEgressInput{
  214. GroupId: aws.String("String"), // Required
  215. CidrIp: aws.String("String"),
  216. DryRun: aws.Bool(true),
  217. FromPort: aws.Int64(1),
  218. IpPermissions: []*ec2.IpPermission{
  219. { // Required
  220. FromPort: aws.Int64(1),
  221. IpProtocol: aws.String("String"),
  222. IpRanges: []*ec2.IpRange{
  223. { // Required
  224. CidrIp: aws.String("String"),
  225. },
  226. // More values...
  227. },
  228. PrefixListIds: []*ec2.PrefixListId{
  229. { // Required
  230. PrefixListId: aws.String("String"),
  231. },
  232. // More values...
  233. },
  234. ToPort: aws.Int64(1),
  235. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  236. { // Required
  237. GroupId: aws.String("String"),
  238. GroupName: aws.String("String"),
  239. UserId: aws.String("String"),
  240. },
  241. // More values...
  242. },
  243. },
  244. // More values...
  245. },
  246. IpProtocol: aws.String("String"),
  247. SourceSecurityGroupName: aws.String("String"),
  248. SourceSecurityGroupOwnerId: aws.String("String"),
  249. ToPort: aws.Int64(1),
  250. }
  251. resp, err := svc.AuthorizeSecurityGroupEgress(params)
  252. if err != nil {
  253. // Print the error, cast err to awserr.Error to get the Code and
  254. // Message from an error.
  255. fmt.Println(err.Error())
  256. return
  257. }
  258. // Pretty-print the response data.
  259. fmt.Println(resp)
  260. }
  261. func ExampleEC2_AuthorizeSecurityGroupIngress() {
  262. svc := ec2.New(nil)
  263. params := &ec2.AuthorizeSecurityGroupIngressInput{
  264. CidrIp: aws.String("String"),
  265. DryRun: aws.Bool(true),
  266. FromPort: aws.Int64(1),
  267. GroupId: aws.String("String"),
  268. GroupName: aws.String("String"),
  269. IpPermissions: []*ec2.IpPermission{
  270. { // Required
  271. FromPort: aws.Int64(1),
  272. IpProtocol: aws.String("String"),
  273. IpRanges: []*ec2.IpRange{
  274. { // Required
  275. CidrIp: aws.String("String"),
  276. },
  277. // More values...
  278. },
  279. PrefixListIds: []*ec2.PrefixListId{
  280. { // Required
  281. PrefixListId: aws.String("String"),
  282. },
  283. // More values...
  284. },
  285. ToPort: aws.Int64(1),
  286. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  287. { // Required
  288. GroupId: aws.String("String"),
  289. GroupName: aws.String("String"),
  290. UserId: aws.String("String"),
  291. },
  292. // More values...
  293. },
  294. },
  295. // More values...
  296. },
  297. IpProtocol: aws.String("String"),
  298. SourceSecurityGroupName: aws.String("String"),
  299. SourceSecurityGroupOwnerId: aws.String("String"),
  300. ToPort: aws.Int64(1),
  301. }
  302. resp, err := svc.AuthorizeSecurityGroupIngress(params)
  303. if err != nil {
  304. // Print the error, cast err to awserr.Error to get the Code and
  305. // Message from an error.
  306. fmt.Println(err.Error())
  307. return
  308. }
  309. // Pretty-print the response data.
  310. fmt.Println(resp)
  311. }
  312. func ExampleEC2_BundleInstance() {
  313. svc := ec2.New(nil)
  314. params := &ec2.BundleInstanceInput{
  315. InstanceId: aws.String("String"), // Required
  316. Storage: &ec2.Storage{ // Required
  317. S3: &ec2.S3Storage{
  318. AWSAccessKeyId: aws.String("String"),
  319. Bucket: aws.String("String"),
  320. Prefix: aws.String("String"),
  321. UploadPolicy: []byte("PAYLOAD"),
  322. UploadPolicySignature: aws.String("String"),
  323. },
  324. },
  325. DryRun: aws.Bool(true),
  326. }
  327. resp, err := svc.BundleInstance(params)
  328. if err != nil {
  329. // Print the error, cast err to awserr.Error to get the Code and
  330. // Message from an error.
  331. fmt.Println(err.Error())
  332. return
  333. }
  334. // Pretty-print the response data.
  335. fmt.Println(resp)
  336. }
  337. func ExampleEC2_CancelBundleTask() {
  338. svc := ec2.New(nil)
  339. params := &ec2.CancelBundleTaskInput{
  340. BundleId: aws.String("String"), // Required
  341. DryRun: aws.Bool(true),
  342. }
  343. resp, err := svc.CancelBundleTask(params)
  344. if err != nil {
  345. // Print the error, cast err to awserr.Error to get the Code and
  346. // Message from an error.
  347. fmt.Println(err.Error())
  348. return
  349. }
  350. // Pretty-print the response data.
  351. fmt.Println(resp)
  352. }
  353. func ExampleEC2_CancelConversionTask() {
  354. svc := ec2.New(nil)
  355. params := &ec2.CancelConversionTaskInput{
  356. ConversionTaskId: aws.String("String"), // Required
  357. DryRun: aws.Bool(true),
  358. ReasonMessage: aws.String("String"),
  359. }
  360. resp, err := svc.CancelConversionTask(params)
  361. if err != nil {
  362. // Print the error, cast err to awserr.Error to get the Code and
  363. // Message from an error.
  364. fmt.Println(err.Error())
  365. return
  366. }
  367. // Pretty-print the response data.
  368. fmt.Println(resp)
  369. }
  370. func ExampleEC2_CancelExportTask() {
  371. svc := ec2.New(nil)
  372. params := &ec2.CancelExportTaskInput{
  373. ExportTaskId: aws.String("String"), // Required
  374. }
  375. resp, err := svc.CancelExportTask(params)
  376. if err != nil {
  377. // Print the error, cast err to awserr.Error to get the Code and
  378. // Message from an error.
  379. fmt.Println(err.Error())
  380. return
  381. }
  382. // Pretty-print the response data.
  383. fmt.Println(resp)
  384. }
  385. func ExampleEC2_CancelImportTask() {
  386. svc := ec2.New(nil)
  387. params := &ec2.CancelImportTaskInput{
  388. CancelReason: aws.String("String"),
  389. DryRun: aws.Bool(true),
  390. ImportTaskId: aws.String("String"),
  391. }
  392. resp, err := svc.CancelImportTask(params)
  393. if err != nil {
  394. // Print the error, cast err to awserr.Error to get the Code and
  395. // Message from an error.
  396. fmt.Println(err.Error())
  397. return
  398. }
  399. // Pretty-print the response data.
  400. fmt.Println(resp)
  401. }
  402. func ExampleEC2_CancelReservedInstancesListing() {
  403. svc := ec2.New(nil)
  404. params := &ec2.CancelReservedInstancesListingInput{
  405. ReservedInstancesListingId: aws.String("String"), // Required
  406. }
  407. resp, err := svc.CancelReservedInstancesListing(params)
  408. if err != nil {
  409. // Print the error, cast err to awserr.Error to get the Code and
  410. // Message from an error.
  411. fmt.Println(err.Error())
  412. return
  413. }
  414. // Pretty-print the response data.
  415. fmt.Println(resp)
  416. }
  417. func ExampleEC2_CancelSpotFleetRequests() {
  418. svc := ec2.New(nil)
  419. params := &ec2.CancelSpotFleetRequestsInput{
  420. SpotFleetRequestIds: []*string{ // Required
  421. aws.String("String"), // Required
  422. // More values...
  423. },
  424. TerminateInstances: aws.Bool(true), // Required
  425. DryRun: aws.Bool(true),
  426. }
  427. resp, err := svc.CancelSpotFleetRequests(params)
  428. if err != nil {
  429. // Print the error, cast err to awserr.Error to get the Code and
  430. // Message from an error.
  431. fmt.Println(err.Error())
  432. return
  433. }
  434. // Pretty-print the response data.
  435. fmt.Println(resp)
  436. }
  437. func ExampleEC2_CancelSpotInstanceRequests() {
  438. svc := ec2.New(nil)
  439. params := &ec2.CancelSpotInstanceRequestsInput{
  440. SpotInstanceRequestIds: []*string{ // Required
  441. aws.String("String"), // Required
  442. // More values...
  443. },
  444. DryRun: aws.Bool(true),
  445. }
  446. resp, err := svc.CancelSpotInstanceRequests(params)
  447. if err != nil {
  448. // Print the error, cast err to awserr.Error to get the Code and
  449. // Message from an error.
  450. fmt.Println(err.Error())
  451. return
  452. }
  453. // Pretty-print the response data.
  454. fmt.Println(resp)
  455. }
  456. func ExampleEC2_ConfirmProductInstance() {
  457. svc := ec2.New(nil)
  458. params := &ec2.ConfirmProductInstanceInput{
  459. InstanceId: aws.String("String"), // Required
  460. ProductCode: aws.String("String"), // Required
  461. DryRun: aws.Bool(true),
  462. }
  463. resp, err := svc.ConfirmProductInstance(params)
  464. if err != nil {
  465. // Print the error, cast err to awserr.Error to get the Code and
  466. // Message from an error.
  467. fmt.Println(err.Error())
  468. return
  469. }
  470. // Pretty-print the response data.
  471. fmt.Println(resp)
  472. }
  473. func ExampleEC2_CopyImage() {
  474. svc := ec2.New(nil)
  475. params := &ec2.CopyImageInput{
  476. Name: aws.String("String"), // Required
  477. SourceImageId: aws.String("String"), // Required
  478. SourceRegion: aws.String("String"), // Required
  479. ClientToken: aws.String("String"),
  480. Description: aws.String("String"),
  481. DryRun: aws.Bool(true),
  482. }
  483. resp, err := svc.CopyImage(params)
  484. if err != nil {
  485. // Print the error, cast err to awserr.Error to get the Code and
  486. // Message from an error.
  487. fmt.Println(err.Error())
  488. return
  489. }
  490. // Pretty-print the response data.
  491. fmt.Println(resp)
  492. }
  493. func ExampleEC2_CopySnapshot() {
  494. svc := ec2.New(nil)
  495. params := &ec2.CopySnapshotInput{
  496. SourceRegion: aws.String("String"), // Required
  497. SourceSnapshotId: aws.String("String"), // Required
  498. Description: aws.String("String"),
  499. DestinationRegion: aws.String("String"),
  500. DryRun: aws.Bool(true),
  501. Encrypted: aws.Bool(true),
  502. KmsKeyId: aws.String("String"),
  503. PresignedUrl: aws.String("String"),
  504. }
  505. resp, err := svc.CopySnapshot(params)
  506. if err != nil {
  507. // Print the error, cast err to awserr.Error to get the Code and
  508. // Message from an error.
  509. fmt.Println(err.Error())
  510. return
  511. }
  512. // Pretty-print the response data.
  513. fmt.Println(resp)
  514. }
  515. func ExampleEC2_CreateCustomerGateway() {
  516. svc := ec2.New(nil)
  517. params := &ec2.CreateCustomerGatewayInput{
  518. BgpAsn: aws.Int64(1), // Required
  519. PublicIp: aws.String("String"), // Required
  520. Type: aws.String("GatewayType"), // Required
  521. DryRun: aws.Bool(true),
  522. }
  523. resp, err := svc.CreateCustomerGateway(params)
  524. if err != nil {
  525. // Print the error, cast err to awserr.Error to get the Code and
  526. // Message from an error.
  527. fmt.Println(err.Error())
  528. return
  529. }
  530. // Pretty-print the response data.
  531. fmt.Println(resp)
  532. }
  533. func ExampleEC2_CreateDhcpOptions() {
  534. svc := ec2.New(nil)
  535. params := &ec2.CreateDhcpOptionsInput{
  536. DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required
  537. { // Required
  538. Key: aws.String("String"),
  539. Values: []*string{
  540. aws.String("String"), // Required
  541. // More values...
  542. },
  543. },
  544. // More values...
  545. },
  546. DryRun: aws.Bool(true),
  547. }
  548. resp, err := svc.CreateDhcpOptions(params)
  549. if err != nil {
  550. // Print the error, cast err to awserr.Error to get the Code and
  551. // Message from an error.
  552. fmt.Println(err.Error())
  553. return
  554. }
  555. // Pretty-print the response data.
  556. fmt.Println(resp)
  557. }
  558. func ExampleEC2_CreateFlowLogs() {
  559. svc := ec2.New(nil)
  560. params := &ec2.CreateFlowLogsInput{
  561. DeliverLogsPermissionArn: aws.String("String"), // Required
  562. LogGroupName: aws.String("String"), // Required
  563. ResourceIds: []*string{ // Required
  564. aws.String("String"), // Required
  565. // More values...
  566. },
  567. ResourceType: aws.String("FlowLogsResourceType"), // Required
  568. TrafficType: aws.String("TrafficType"), // Required
  569. ClientToken: aws.String("String"),
  570. }
  571. resp, err := svc.CreateFlowLogs(params)
  572. if err != nil {
  573. // Print the error, cast err to awserr.Error to get the Code and
  574. // Message from an error.
  575. fmt.Println(err.Error())
  576. return
  577. }
  578. // Pretty-print the response data.
  579. fmt.Println(resp)
  580. }
  581. func ExampleEC2_CreateImage() {
  582. svc := ec2.New(nil)
  583. params := &ec2.CreateImageInput{
  584. InstanceId: aws.String("String"), // Required
  585. Name: aws.String("String"), // Required
  586. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  587. { // Required
  588. DeviceName: aws.String("String"),
  589. Ebs: &ec2.EbsBlockDevice{
  590. DeleteOnTermination: aws.Bool(true),
  591. Encrypted: aws.Bool(true),
  592. Iops: aws.Int64(1),
  593. SnapshotId: aws.String("String"),
  594. VolumeSize: aws.Int64(1),
  595. VolumeType: aws.String("VolumeType"),
  596. },
  597. NoDevice: aws.String("String"),
  598. VirtualName: aws.String("String"),
  599. },
  600. // More values...
  601. },
  602. Description: aws.String("String"),
  603. DryRun: aws.Bool(true),
  604. NoReboot: aws.Bool(true),
  605. }
  606. resp, err := svc.CreateImage(params)
  607. if err != nil {
  608. // Print the error, cast err to awserr.Error to get the Code and
  609. // Message from an error.
  610. fmt.Println(err.Error())
  611. return
  612. }
  613. // Pretty-print the response data.
  614. fmt.Println(resp)
  615. }
  616. func ExampleEC2_CreateInstanceExportTask() {
  617. svc := ec2.New(nil)
  618. params := &ec2.CreateInstanceExportTaskInput{
  619. InstanceId: aws.String("String"), // Required
  620. Description: aws.String("String"),
  621. ExportToS3Task: &ec2.ExportToS3TaskSpecification{
  622. ContainerFormat: aws.String("ContainerFormat"),
  623. DiskImageFormat: aws.String("DiskImageFormat"),
  624. S3Bucket: aws.String("String"),
  625. S3Prefix: aws.String("String"),
  626. },
  627. TargetEnvironment: aws.String("ExportEnvironment"),
  628. }
  629. resp, err := svc.CreateInstanceExportTask(params)
  630. if err != nil {
  631. // Print the error, cast err to awserr.Error to get the Code and
  632. // Message from an error.
  633. fmt.Println(err.Error())
  634. return
  635. }
  636. // Pretty-print the response data.
  637. fmt.Println(resp)
  638. }
  639. func ExampleEC2_CreateInternetGateway() {
  640. svc := ec2.New(nil)
  641. params := &ec2.CreateInternetGatewayInput{
  642. DryRun: aws.Bool(true),
  643. }
  644. resp, err := svc.CreateInternetGateway(params)
  645. if err != nil {
  646. // Print the error, cast err to awserr.Error to get the Code and
  647. // Message from an error.
  648. fmt.Println(err.Error())
  649. return
  650. }
  651. // Pretty-print the response data.
  652. fmt.Println(resp)
  653. }
  654. func ExampleEC2_CreateKeyPair() {
  655. svc := ec2.New(nil)
  656. params := &ec2.CreateKeyPairInput{
  657. KeyName: aws.String("String"), // Required
  658. DryRun: aws.Bool(true),
  659. }
  660. resp, err := svc.CreateKeyPair(params)
  661. if err != nil {
  662. // Print the error, cast err to awserr.Error to get the Code and
  663. // Message from an error.
  664. fmt.Println(err.Error())
  665. return
  666. }
  667. // Pretty-print the response data.
  668. fmt.Println(resp)
  669. }
  670. func ExampleEC2_CreateNetworkAcl() {
  671. svc := ec2.New(nil)
  672. params := &ec2.CreateNetworkAclInput{
  673. VpcId: aws.String("String"), // Required
  674. DryRun: aws.Bool(true),
  675. }
  676. resp, err := svc.CreateNetworkAcl(params)
  677. if err != nil {
  678. // Print the error, cast err to awserr.Error to get the Code and
  679. // Message from an error.
  680. fmt.Println(err.Error())
  681. return
  682. }
  683. // Pretty-print the response data.
  684. fmt.Println(resp)
  685. }
  686. func ExampleEC2_CreateNetworkAclEntry() {
  687. svc := ec2.New(nil)
  688. params := &ec2.CreateNetworkAclEntryInput{
  689. CidrBlock: aws.String("String"), // Required
  690. Egress: aws.Bool(true), // Required
  691. NetworkAclId: aws.String("String"), // Required
  692. Protocol: aws.String("String"), // Required
  693. RuleAction: aws.String("RuleAction"), // Required
  694. RuleNumber: aws.Int64(1), // Required
  695. DryRun: aws.Bool(true),
  696. IcmpTypeCode: &ec2.IcmpTypeCode{
  697. Code: aws.Int64(1),
  698. Type: aws.Int64(1),
  699. },
  700. PortRange: &ec2.PortRange{
  701. From: aws.Int64(1),
  702. To: aws.Int64(1),
  703. },
  704. }
  705. resp, err := svc.CreateNetworkAclEntry(params)
  706. if err != nil {
  707. // Print the error, cast err to awserr.Error to get the Code and
  708. // Message from an error.
  709. fmt.Println(err.Error())
  710. return
  711. }
  712. // Pretty-print the response data.
  713. fmt.Println(resp)
  714. }
  715. func ExampleEC2_CreateNetworkInterface() {
  716. svc := ec2.New(nil)
  717. params := &ec2.CreateNetworkInterfaceInput{
  718. SubnetId: aws.String("String"), // Required
  719. Description: aws.String("String"),
  720. DryRun: aws.Bool(true),
  721. Groups: []*string{
  722. aws.String("String"), // Required
  723. // More values...
  724. },
  725. PrivateIpAddress: aws.String("String"),
  726. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  727. { // Required
  728. PrivateIpAddress: aws.String("String"), // Required
  729. Primary: aws.Bool(true),
  730. },
  731. // More values...
  732. },
  733. SecondaryPrivateIpAddressCount: aws.Int64(1),
  734. }
  735. resp, err := svc.CreateNetworkInterface(params)
  736. if err != nil {
  737. // Print the error, cast err to awserr.Error to get the Code and
  738. // Message from an error.
  739. fmt.Println(err.Error())
  740. return
  741. }
  742. // Pretty-print the response data.
  743. fmt.Println(resp)
  744. }
  745. func ExampleEC2_CreatePlacementGroup() {
  746. svc := ec2.New(nil)
  747. params := &ec2.CreatePlacementGroupInput{
  748. GroupName: aws.String("String"), // Required
  749. Strategy: aws.String("PlacementStrategy"), // Required
  750. DryRun: aws.Bool(true),
  751. }
  752. resp, err := svc.CreatePlacementGroup(params)
  753. if err != nil {
  754. // Print the error, cast err to awserr.Error to get the Code and
  755. // Message from an error.
  756. fmt.Println(err.Error())
  757. return
  758. }
  759. // Pretty-print the response data.
  760. fmt.Println(resp)
  761. }
  762. func ExampleEC2_CreateReservedInstancesListing() {
  763. svc := ec2.New(nil)
  764. params := &ec2.CreateReservedInstancesListingInput{
  765. ClientToken: aws.String("String"), // Required
  766. InstanceCount: aws.Int64(1), // Required
  767. PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required
  768. { // Required
  769. CurrencyCode: aws.String("CurrencyCodeValues"),
  770. Price: aws.Float64(1.0),
  771. Term: aws.Int64(1),
  772. },
  773. // More values...
  774. },
  775. ReservedInstancesId: aws.String("String"), // Required
  776. }
  777. resp, err := svc.CreateReservedInstancesListing(params)
  778. if err != nil {
  779. // Print the error, cast err to awserr.Error to get the Code and
  780. // Message from an error.
  781. fmt.Println(err.Error())
  782. return
  783. }
  784. // Pretty-print the response data.
  785. fmt.Println(resp)
  786. }
  787. func ExampleEC2_CreateRoute() {
  788. svc := ec2.New(nil)
  789. params := &ec2.CreateRouteInput{
  790. DestinationCidrBlock: aws.String("String"), // Required
  791. RouteTableId: aws.String("String"), // Required
  792. DryRun: aws.Bool(true),
  793. GatewayId: aws.String("String"),
  794. InstanceId: aws.String("String"),
  795. NetworkInterfaceId: aws.String("String"),
  796. VpcPeeringConnectionId: aws.String("String"),
  797. }
  798. resp, err := svc.CreateRoute(params)
  799. if err != nil {
  800. // Print the error, cast err to awserr.Error to get the Code and
  801. // Message from an error.
  802. fmt.Println(err.Error())
  803. return
  804. }
  805. // Pretty-print the response data.
  806. fmt.Println(resp)
  807. }
  808. func ExampleEC2_CreateRouteTable() {
  809. svc := ec2.New(nil)
  810. params := &ec2.CreateRouteTableInput{
  811. VpcId: aws.String("String"), // Required
  812. DryRun: aws.Bool(true),
  813. }
  814. resp, err := svc.CreateRouteTable(params)
  815. if err != nil {
  816. // Print the error, cast err to awserr.Error to get the Code and
  817. // Message from an error.
  818. fmt.Println(err.Error())
  819. return
  820. }
  821. // Pretty-print the response data.
  822. fmt.Println(resp)
  823. }
  824. func ExampleEC2_CreateSecurityGroup() {
  825. svc := ec2.New(nil)
  826. params := &ec2.CreateSecurityGroupInput{
  827. Description: aws.String("String"), // Required
  828. GroupName: aws.String("String"), // Required
  829. DryRun: aws.Bool(true),
  830. VpcId: aws.String("String"),
  831. }
  832. resp, err := svc.CreateSecurityGroup(params)
  833. if err != nil {
  834. // Print the error, cast err to awserr.Error to get the Code and
  835. // Message from an error.
  836. fmt.Println(err.Error())
  837. return
  838. }
  839. // Pretty-print the response data.
  840. fmt.Println(resp)
  841. }
  842. func ExampleEC2_CreateSnapshot() {
  843. svc := ec2.New(nil)
  844. params := &ec2.CreateSnapshotInput{
  845. VolumeId: aws.String("String"), // Required
  846. Description: aws.String("String"),
  847. DryRun: aws.Bool(true),
  848. }
  849. resp, err := svc.CreateSnapshot(params)
  850. if err != nil {
  851. // Print the error, cast err to awserr.Error to get the Code and
  852. // Message from an error.
  853. fmt.Println(err.Error())
  854. return
  855. }
  856. // Pretty-print the response data.
  857. fmt.Println(resp)
  858. }
  859. func ExampleEC2_CreateSpotDatafeedSubscription() {
  860. svc := ec2.New(nil)
  861. params := &ec2.CreateSpotDatafeedSubscriptionInput{
  862. Bucket: aws.String("String"), // Required
  863. DryRun: aws.Bool(true),
  864. Prefix: aws.String("String"),
  865. }
  866. resp, err := svc.CreateSpotDatafeedSubscription(params)
  867. if err != nil {
  868. // Print the error, cast err to awserr.Error to get the Code and
  869. // Message from an error.
  870. fmt.Println(err.Error())
  871. return
  872. }
  873. // Pretty-print the response data.
  874. fmt.Println(resp)
  875. }
  876. func ExampleEC2_CreateSubnet() {
  877. svc := ec2.New(nil)
  878. params := &ec2.CreateSubnetInput{
  879. CidrBlock: aws.String("String"), // Required
  880. VpcId: aws.String("String"), // Required
  881. AvailabilityZone: aws.String("String"),
  882. DryRun: aws.Bool(true),
  883. }
  884. resp, err := svc.CreateSubnet(params)
  885. if err != nil {
  886. // Print the error, cast err to awserr.Error to get the Code and
  887. // Message from an error.
  888. fmt.Println(err.Error())
  889. return
  890. }
  891. // Pretty-print the response data.
  892. fmt.Println(resp)
  893. }
  894. func ExampleEC2_CreateTags() {
  895. svc := ec2.New(nil)
  896. params := &ec2.CreateTagsInput{
  897. Resources: []*string{ // Required
  898. aws.String("String"), // Required
  899. // More values...
  900. },
  901. Tags: []*ec2.Tag{ // Required
  902. { // Required
  903. Key: aws.String("String"),
  904. Value: aws.String("String"),
  905. },
  906. // More values...
  907. },
  908. DryRun: aws.Bool(true),
  909. }
  910. resp, err := svc.CreateTags(params)
  911. if err != nil {
  912. // Print the error, cast err to awserr.Error to get the Code and
  913. // Message from an error.
  914. fmt.Println(err.Error())
  915. return
  916. }
  917. // Pretty-print the response data.
  918. fmt.Println(resp)
  919. }
  920. func ExampleEC2_CreateVolume() {
  921. svc := ec2.New(nil)
  922. params := &ec2.CreateVolumeInput{
  923. AvailabilityZone: aws.String("String"), // Required
  924. DryRun: aws.Bool(true),
  925. Encrypted: aws.Bool(true),
  926. Iops: aws.Int64(1),
  927. KmsKeyId: aws.String("String"),
  928. Size: aws.Int64(1),
  929. SnapshotId: aws.String("String"),
  930. VolumeType: aws.String("VolumeType"),
  931. }
  932. resp, err := svc.CreateVolume(params)
  933. if err != nil {
  934. // Print the error, cast err to awserr.Error to get the Code and
  935. // Message from an error.
  936. fmt.Println(err.Error())
  937. return
  938. }
  939. // Pretty-print the response data.
  940. fmt.Println(resp)
  941. }
  942. func ExampleEC2_CreateVpc() {
  943. svc := ec2.New(nil)
  944. params := &ec2.CreateVpcInput{
  945. CidrBlock: aws.String("String"), // Required
  946. DryRun: aws.Bool(true),
  947. InstanceTenancy: aws.String("Tenancy"),
  948. }
  949. resp, err := svc.CreateVpc(params)
  950. if err != nil {
  951. // Print the error, cast err to awserr.Error to get the Code and
  952. // Message from an error.
  953. fmt.Println(err.Error())
  954. return
  955. }
  956. // Pretty-print the response data.
  957. fmt.Println(resp)
  958. }
  959. func ExampleEC2_CreateVpcEndpoint() {
  960. svc := ec2.New(nil)
  961. params := &ec2.CreateVpcEndpointInput{
  962. ServiceName: aws.String("String"), // Required
  963. VpcId: aws.String("String"), // Required
  964. ClientToken: aws.String("String"),
  965. DryRun: aws.Bool(true),
  966. PolicyDocument: aws.String("String"),
  967. RouteTableIds: []*string{
  968. aws.String("String"), // Required
  969. // More values...
  970. },
  971. }
  972. resp, err := svc.CreateVpcEndpoint(params)
  973. if err != nil {
  974. // Print the error, cast err to awserr.Error to get the Code and
  975. // Message from an error.
  976. fmt.Println(err.Error())
  977. return
  978. }
  979. // Pretty-print the response data.
  980. fmt.Println(resp)
  981. }
  982. func ExampleEC2_CreateVpcPeeringConnection() {
  983. svc := ec2.New(nil)
  984. params := &ec2.CreateVpcPeeringConnectionInput{
  985. DryRun: aws.Bool(true),
  986. PeerOwnerId: aws.String("String"),
  987. PeerVpcId: aws.String("String"),
  988. VpcId: aws.String("String"),
  989. }
  990. resp, err := svc.CreateVpcPeeringConnection(params)
  991. if err != nil {
  992. // Print the error, cast err to awserr.Error to get the Code and
  993. // Message from an error.
  994. fmt.Println(err.Error())
  995. return
  996. }
  997. // Pretty-print the response data.
  998. fmt.Println(resp)
  999. }
  1000. func ExampleEC2_CreateVpnConnection() {
  1001. svc := ec2.New(nil)
  1002. params := &ec2.CreateVpnConnectionInput{
  1003. CustomerGatewayId: aws.String("String"), // Required
  1004. Type: aws.String("String"), // Required
  1005. VpnGatewayId: aws.String("String"), // Required
  1006. DryRun: aws.Bool(true),
  1007. Options: &ec2.VpnConnectionOptionsSpecification{
  1008. StaticRoutesOnly: aws.Bool(true),
  1009. },
  1010. }
  1011. resp, err := svc.CreateVpnConnection(params)
  1012. if err != nil {
  1013. // Print the error, cast err to awserr.Error to get the Code and
  1014. // Message from an error.
  1015. fmt.Println(err.Error())
  1016. return
  1017. }
  1018. // Pretty-print the response data.
  1019. fmt.Println(resp)
  1020. }
  1021. func ExampleEC2_CreateVpnConnectionRoute() {
  1022. svc := ec2.New(nil)
  1023. params := &ec2.CreateVpnConnectionRouteInput{
  1024. DestinationCidrBlock: aws.String("String"), // Required
  1025. VpnConnectionId: aws.String("String"), // Required
  1026. }
  1027. resp, err := svc.CreateVpnConnectionRoute(params)
  1028. if err != nil {
  1029. // Print the error, cast err to awserr.Error to get the Code and
  1030. // Message from an error.
  1031. fmt.Println(err.Error())
  1032. return
  1033. }
  1034. // Pretty-print the response data.
  1035. fmt.Println(resp)
  1036. }
  1037. func ExampleEC2_CreateVpnGateway() {
  1038. svc := ec2.New(nil)
  1039. params := &ec2.CreateVpnGatewayInput{
  1040. Type: aws.String("GatewayType"), // Required
  1041. AvailabilityZone: aws.String("String"),
  1042. DryRun: aws.Bool(true),
  1043. }
  1044. resp, err := svc.CreateVpnGateway(params)
  1045. if err != nil {
  1046. // Print the error, cast err to awserr.Error to get the Code and
  1047. // Message from an error.
  1048. fmt.Println(err.Error())
  1049. return
  1050. }
  1051. // Pretty-print the response data.
  1052. fmt.Println(resp)
  1053. }
  1054. func ExampleEC2_DeleteCustomerGateway() {
  1055. svc := ec2.New(nil)
  1056. params := &ec2.DeleteCustomerGatewayInput{
  1057. CustomerGatewayId: aws.String("String"), // Required
  1058. DryRun: aws.Bool(true),
  1059. }
  1060. resp, err := svc.DeleteCustomerGateway(params)
  1061. if err != nil {
  1062. // Print the error, cast err to awserr.Error to get the Code and
  1063. // Message from an error.
  1064. fmt.Println(err.Error())
  1065. return
  1066. }
  1067. // Pretty-print the response data.
  1068. fmt.Println(resp)
  1069. }
  1070. func ExampleEC2_DeleteDhcpOptions() {
  1071. svc := ec2.New(nil)
  1072. params := &ec2.DeleteDhcpOptionsInput{
  1073. DhcpOptionsId: aws.String("String"), // Required
  1074. DryRun: aws.Bool(true),
  1075. }
  1076. resp, err := svc.DeleteDhcpOptions(params)
  1077. if err != nil {
  1078. // Print the error, cast err to awserr.Error to get the Code and
  1079. // Message from an error.
  1080. fmt.Println(err.Error())
  1081. return
  1082. }
  1083. // Pretty-print the response data.
  1084. fmt.Println(resp)
  1085. }
  1086. func ExampleEC2_DeleteFlowLogs() {
  1087. svc := ec2.New(nil)
  1088. params := &ec2.DeleteFlowLogsInput{
  1089. FlowLogIds: []*string{ // Required
  1090. aws.String("String"), // Required
  1091. // More values...
  1092. },
  1093. }
  1094. resp, err := svc.DeleteFlowLogs(params)
  1095. if err != nil {
  1096. // Print the error, cast err to awserr.Error to get the Code and
  1097. // Message from an error.
  1098. fmt.Println(err.Error())
  1099. return
  1100. }
  1101. // Pretty-print the response data.
  1102. fmt.Println(resp)
  1103. }
  1104. func ExampleEC2_DeleteInternetGateway() {
  1105. svc := ec2.New(nil)
  1106. params := &ec2.DeleteInternetGatewayInput{
  1107. InternetGatewayId: aws.String("String"), // Required
  1108. DryRun: aws.Bool(true),
  1109. }
  1110. resp, err := svc.DeleteInternetGateway(params)
  1111. if err != nil {
  1112. // Print the error, cast err to awserr.Error to get the Code and
  1113. // Message from an error.
  1114. fmt.Println(err.Error())
  1115. return
  1116. }
  1117. // Pretty-print the response data.
  1118. fmt.Println(resp)
  1119. }
  1120. func ExampleEC2_DeleteKeyPair() {
  1121. svc := ec2.New(nil)
  1122. params := &ec2.DeleteKeyPairInput{
  1123. KeyName: aws.String("String"), // Required
  1124. DryRun: aws.Bool(true),
  1125. }
  1126. resp, err := svc.DeleteKeyPair(params)
  1127. if err != nil {
  1128. // Print the error, cast err to awserr.Error to get the Code and
  1129. // Message from an error.
  1130. fmt.Println(err.Error())
  1131. return
  1132. }
  1133. // Pretty-print the response data.
  1134. fmt.Println(resp)
  1135. }
  1136. func ExampleEC2_DeleteNetworkAcl() {
  1137. svc := ec2.New(nil)
  1138. params := &ec2.DeleteNetworkAclInput{
  1139. NetworkAclId: aws.String("String"), // Required
  1140. DryRun: aws.Bool(true),
  1141. }
  1142. resp, err := svc.DeleteNetworkAcl(params)
  1143. if err != nil {
  1144. // Print the error, cast err to awserr.Error to get the Code and
  1145. // Message from an error.
  1146. fmt.Println(err.Error())
  1147. return
  1148. }
  1149. // Pretty-print the response data.
  1150. fmt.Println(resp)
  1151. }
  1152. func ExampleEC2_DeleteNetworkAclEntry() {
  1153. svc := ec2.New(nil)
  1154. params := &ec2.DeleteNetworkAclEntryInput{
  1155. Egress: aws.Bool(true), // Required
  1156. NetworkAclId: aws.String("String"), // Required
  1157. RuleNumber: aws.Int64(1), // Required
  1158. DryRun: aws.Bool(true),
  1159. }
  1160. resp, err := svc.DeleteNetworkAclEntry(params)
  1161. if err != nil {
  1162. // Print the error, cast err to awserr.Error to get the Code and
  1163. // Message from an error.
  1164. fmt.Println(err.Error())
  1165. return
  1166. }
  1167. // Pretty-print the response data.
  1168. fmt.Println(resp)
  1169. }
  1170. func ExampleEC2_DeleteNetworkInterface() {
  1171. svc := ec2.New(nil)
  1172. params := &ec2.DeleteNetworkInterfaceInput{
  1173. NetworkInterfaceId: aws.String("String"), // Required
  1174. DryRun: aws.Bool(true),
  1175. }
  1176. resp, err := svc.DeleteNetworkInterface(params)
  1177. if err != nil {
  1178. // Print the error, cast err to awserr.Error to get the Code and
  1179. // Message from an error.
  1180. fmt.Println(err.Error())
  1181. return
  1182. }
  1183. // Pretty-print the response data.
  1184. fmt.Println(resp)
  1185. }
  1186. func ExampleEC2_DeletePlacementGroup() {
  1187. svc := ec2.New(nil)
  1188. params := &ec2.DeletePlacementGroupInput{
  1189. GroupName: aws.String("String"), // Required
  1190. DryRun: aws.Bool(true),
  1191. }
  1192. resp, err := svc.DeletePlacementGroup(params)
  1193. if err != nil {
  1194. // Print the error, cast err to awserr.Error to get the Code and
  1195. // Message from an error.
  1196. fmt.Println(err.Error())
  1197. return
  1198. }
  1199. // Pretty-print the response data.
  1200. fmt.Println(resp)
  1201. }
  1202. func ExampleEC2_DeleteRoute() {
  1203. svc := ec2.New(nil)
  1204. params := &ec2.DeleteRouteInput{
  1205. DestinationCidrBlock: aws.String("String"), // Required
  1206. RouteTableId: aws.String("String"), // Required
  1207. DryRun: aws.Bool(true),
  1208. }
  1209. resp, err := svc.DeleteRoute(params)
  1210. if err != nil {
  1211. // Print the error, cast err to awserr.Error to get the Code and
  1212. // Message from an error.
  1213. fmt.Println(err.Error())
  1214. return
  1215. }
  1216. // Pretty-print the response data.
  1217. fmt.Println(resp)
  1218. }
  1219. func ExampleEC2_DeleteRouteTable() {
  1220. svc := ec2.New(nil)
  1221. params := &ec2.DeleteRouteTableInput{
  1222. RouteTableId: aws.String("String"), // Required
  1223. DryRun: aws.Bool(true),
  1224. }
  1225. resp, err := svc.DeleteRouteTable(params)
  1226. if err != nil {
  1227. // Print the error, cast err to awserr.Error to get the Code and
  1228. // Message from an error.
  1229. fmt.Println(err.Error())
  1230. return
  1231. }
  1232. // Pretty-print the response data.
  1233. fmt.Println(resp)
  1234. }
  1235. func ExampleEC2_DeleteSecurityGroup() {
  1236. svc := ec2.New(nil)
  1237. params := &ec2.DeleteSecurityGroupInput{
  1238. DryRun: aws.Bool(true),
  1239. GroupId: aws.String("String"),
  1240. GroupName: aws.String("String"),
  1241. }
  1242. resp, err := svc.DeleteSecurityGroup(params)
  1243. if err != nil {
  1244. // Print the error, cast err to awserr.Error to get the Code and
  1245. // Message from an error.
  1246. fmt.Println(err.Error())
  1247. return
  1248. }
  1249. // Pretty-print the response data.
  1250. fmt.Println(resp)
  1251. }
  1252. func ExampleEC2_DeleteSnapshot() {
  1253. svc := ec2.New(nil)
  1254. params := &ec2.DeleteSnapshotInput{
  1255. SnapshotId: aws.String("String"), // Required
  1256. DryRun: aws.Bool(true),
  1257. }
  1258. resp, err := svc.DeleteSnapshot(params)
  1259. if err != nil {
  1260. // Print the error, cast err to awserr.Error to get the Code and
  1261. // Message from an error.
  1262. fmt.Println(err.Error())
  1263. return
  1264. }
  1265. // Pretty-print the response data.
  1266. fmt.Println(resp)
  1267. }
  1268. func ExampleEC2_DeleteSpotDatafeedSubscription() {
  1269. svc := ec2.New(nil)
  1270. params := &ec2.DeleteSpotDatafeedSubscriptionInput{
  1271. DryRun: aws.Bool(true),
  1272. }
  1273. resp, err := svc.DeleteSpotDatafeedSubscription(params)
  1274. if err != nil {
  1275. // Print the error, cast err to awserr.Error to get the Code and
  1276. // Message from an error.
  1277. fmt.Println(err.Error())
  1278. return
  1279. }
  1280. // Pretty-print the response data.
  1281. fmt.Println(resp)
  1282. }
  1283. func ExampleEC2_DeleteSubnet() {
  1284. svc := ec2.New(nil)
  1285. params := &ec2.DeleteSubnetInput{
  1286. SubnetId: aws.String("String"), // Required
  1287. DryRun: aws.Bool(true),
  1288. }
  1289. resp, err := svc.DeleteSubnet(params)
  1290. if err != nil {
  1291. // Print the error, cast err to awserr.Error to get the Code and
  1292. // Message from an error.
  1293. fmt.Println(err.Error())
  1294. return
  1295. }
  1296. // Pretty-print the response data.
  1297. fmt.Println(resp)
  1298. }
  1299. func ExampleEC2_DeleteTags() {
  1300. svc := ec2.New(nil)
  1301. params := &ec2.DeleteTagsInput{
  1302. Resources: []*string{ // Required
  1303. aws.String("String"), // Required
  1304. // More values...
  1305. },
  1306. DryRun: aws.Bool(true),
  1307. Tags: []*ec2.Tag{
  1308. { // Required
  1309. Key: aws.String("String"),
  1310. Value: aws.String("String"),
  1311. },
  1312. // More values...
  1313. },
  1314. }
  1315. resp, err := svc.DeleteTags(params)
  1316. if err != nil {
  1317. // Print the error, cast err to awserr.Error to get the Code and
  1318. // Message from an error.
  1319. fmt.Println(err.Error())
  1320. return
  1321. }
  1322. // Pretty-print the response data.
  1323. fmt.Println(resp)
  1324. }
  1325. func ExampleEC2_DeleteVolume() {
  1326. svc := ec2.New(nil)
  1327. params := &ec2.DeleteVolumeInput{
  1328. VolumeId: aws.String("String"), // Required
  1329. DryRun: aws.Bool(true),
  1330. }
  1331. resp, err := svc.DeleteVolume(params)
  1332. if err != nil {
  1333. // Print the error, cast err to awserr.Error to get the Code and
  1334. // Message from an error.
  1335. fmt.Println(err.Error())
  1336. return
  1337. }
  1338. // Pretty-print the response data.
  1339. fmt.Println(resp)
  1340. }
  1341. func ExampleEC2_DeleteVpc() {
  1342. svc := ec2.New(nil)
  1343. params := &ec2.DeleteVpcInput{
  1344. VpcId: aws.String("String"), // Required
  1345. DryRun: aws.Bool(true),
  1346. }
  1347. resp, err := svc.DeleteVpc(params)
  1348. if err != nil {
  1349. // Print the error, cast err to awserr.Error to get the Code and
  1350. // Message from an error.
  1351. fmt.Println(err.Error())
  1352. return
  1353. }
  1354. // Pretty-print the response data.
  1355. fmt.Println(resp)
  1356. }
  1357. func ExampleEC2_DeleteVpcEndpoints() {
  1358. svc := ec2.New(nil)
  1359. params := &ec2.DeleteVpcEndpointsInput{
  1360. VpcEndpointIds: []*string{ // Required
  1361. aws.String("String"), // Required
  1362. // More values...
  1363. },
  1364. DryRun: aws.Bool(true),
  1365. }
  1366. resp, err := svc.DeleteVpcEndpoints(params)
  1367. if err != nil {
  1368. // Print the error, cast err to awserr.Error to get the Code and
  1369. // Message from an error.
  1370. fmt.Println(err.Error())
  1371. return
  1372. }
  1373. // Pretty-print the response data.
  1374. fmt.Println(resp)
  1375. }
  1376. func ExampleEC2_DeleteVpcPeeringConnection() {
  1377. svc := ec2.New(nil)
  1378. params := &ec2.DeleteVpcPeeringConnectionInput{
  1379. VpcPeeringConnectionId: aws.String("String"), // Required
  1380. DryRun: aws.Bool(true),
  1381. }
  1382. resp, err := svc.DeleteVpcPeeringConnection(params)
  1383. if err != nil {
  1384. // Print the error, cast err to awserr.Error to get the Code and
  1385. // Message from an error.
  1386. fmt.Println(err.Error())
  1387. return
  1388. }
  1389. // Pretty-print the response data.
  1390. fmt.Println(resp)
  1391. }
  1392. func ExampleEC2_DeleteVpnConnection() {
  1393. svc := ec2.New(nil)
  1394. params := &ec2.DeleteVpnConnectionInput{
  1395. VpnConnectionId: aws.String("String"), // Required
  1396. DryRun: aws.Bool(true),
  1397. }
  1398. resp, err := svc.DeleteVpnConnection(params)
  1399. if err != nil {
  1400. // Print the error, cast err to awserr.Error to get the Code and
  1401. // Message from an error.
  1402. fmt.Println(err.Error())
  1403. return
  1404. }
  1405. // Pretty-print the response data.
  1406. fmt.Println(resp)
  1407. }
  1408. func ExampleEC2_DeleteVpnConnectionRoute() {
  1409. svc := ec2.New(nil)
  1410. params := &ec2.DeleteVpnConnectionRouteInput{
  1411. DestinationCidrBlock: aws.String("String"), // Required
  1412. VpnConnectionId: aws.String("String"), // Required
  1413. }
  1414. resp, err := svc.DeleteVpnConnectionRoute(params)
  1415. if err != nil {
  1416. // Print the error, cast err to awserr.Error to get the Code and
  1417. // Message from an error.
  1418. fmt.Println(err.Error())
  1419. return
  1420. }
  1421. // Pretty-print the response data.
  1422. fmt.Println(resp)
  1423. }
  1424. func ExampleEC2_DeleteVpnGateway() {
  1425. svc := ec2.New(nil)
  1426. params := &ec2.DeleteVpnGatewayInput{
  1427. VpnGatewayId: aws.String("String"), // Required
  1428. DryRun: aws.Bool(true),
  1429. }
  1430. resp, err := svc.DeleteVpnGateway(params)
  1431. if err != nil {
  1432. // Print the error, cast err to awserr.Error to get the Code and
  1433. // Message from an error.
  1434. fmt.Println(err.Error())
  1435. return
  1436. }
  1437. // Pretty-print the response data.
  1438. fmt.Println(resp)
  1439. }
  1440. func ExampleEC2_DeregisterImage() {
  1441. svc := ec2.New(nil)
  1442. params := &ec2.DeregisterImageInput{
  1443. ImageId: aws.String("String"), // Required
  1444. DryRun: aws.Bool(true),
  1445. }
  1446. resp, err := svc.DeregisterImage(params)
  1447. if err != nil {
  1448. // Print the error, cast err to awserr.Error to get the Code and
  1449. // Message from an error.
  1450. fmt.Println(err.Error())
  1451. return
  1452. }
  1453. // Pretty-print the response data.
  1454. fmt.Println(resp)
  1455. }
  1456. func ExampleEC2_DescribeAccountAttributes() {
  1457. svc := ec2.New(nil)
  1458. params := &ec2.DescribeAccountAttributesInput{
  1459. AttributeNames: []*string{
  1460. aws.String("AccountAttributeName"), // Required
  1461. // More values...
  1462. },
  1463. DryRun: aws.Bool(true),
  1464. }
  1465. resp, err := svc.DescribeAccountAttributes(params)
  1466. if err != nil {
  1467. // Print the error, cast err to awserr.Error to get the Code and
  1468. // Message from an error.
  1469. fmt.Println(err.Error())
  1470. return
  1471. }
  1472. // Pretty-print the response data.
  1473. fmt.Println(resp)
  1474. }
  1475. func ExampleEC2_DescribeAddresses() {
  1476. svc := ec2.New(nil)
  1477. params := &ec2.DescribeAddressesInput{
  1478. AllocationIds: []*string{
  1479. aws.String("String"), // Required
  1480. // More values...
  1481. },
  1482. DryRun: aws.Bool(true),
  1483. Filters: []*ec2.Filter{
  1484. { // Required
  1485. Name: aws.String("String"),
  1486. Values: []*string{
  1487. aws.String("String"), // Required
  1488. // More values...
  1489. },
  1490. },
  1491. // More values...
  1492. },
  1493. PublicIps: []*string{
  1494. aws.String("String"), // Required
  1495. // More values...
  1496. },
  1497. }
  1498. resp, err := svc.DescribeAddresses(params)
  1499. if err != nil {
  1500. // Print the error, cast err to awserr.Error to get the Code and
  1501. // Message from an error.
  1502. fmt.Println(err.Error())
  1503. return
  1504. }
  1505. // Pretty-print the response data.
  1506. fmt.Println(resp)
  1507. }
  1508. func ExampleEC2_DescribeAvailabilityZones() {
  1509. svc := ec2.New(nil)
  1510. params := &ec2.DescribeAvailabilityZonesInput{
  1511. DryRun: aws.Bool(true),
  1512. Filters: []*ec2.Filter{
  1513. { // Required
  1514. Name: aws.String("String"),
  1515. Values: []*string{
  1516. aws.String("String"), // Required
  1517. // More values...
  1518. },
  1519. },
  1520. // More values...
  1521. },
  1522. ZoneNames: []*string{
  1523. aws.String("String"), // Required
  1524. // More values...
  1525. },
  1526. }
  1527. resp, err := svc.DescribeAvailabilityZones(params)
  1528. if err != nil {
  1529. // Print the error, cast err to awserr.Error to get the Code and
  1530. // Message from an error.
  1531. fmt.Println(err.Error())
  1532. return
  1533. }
  1534. // Pretty-print the response data.
  1535. fmt.Println(resp)
  1536. }
  1537. func ExampleEC2_DescribeBundleTasks() {
  1538. svc := ec2.New(nil)
  1539. params := &ec2.DescribeBundleTasksInput{
  1540. BundleIds: []*string{
  1541. aws.String("String"), // Required
  1542. // More values...
  1543. },
  1544. DryRun: aws.Bool(true),
  1545. Filters: []*ec2.Filter{
  1546. { // Required
  1547. Name: aws.String("String"),
  1548. Values: []*string{
  1549. aws.String("String"), // Required
  1550. // More values...
  1551. },
  1552. },
  1553. // More values...
  1554. },
  1555. }
  1556. resp, err := svc.DescribeBundleTasks(params)
  1557. if err != nil {
  1558. // Print the error, cast err to awserr.Error to get the Code and
  1559. // Message from an error.
  1560. fmt.Println(err.Error())
  1561. return
  1562. }
  1563. // Pretty-print the response data.
  1564. fmt.Println(resp)
  1565. }
  1566. func ExampleEC2_DescribeClassicLinkInstances() {
  1567. svc := ec2.New(nil)
  1568. params := &ec2.DescribeClassicLinkInstancesInput{
  1569. DryRun: aws.Bool(true),
  1570. Filters: []*ec2.Filter{
  1571. { // Required
  1572. Name: aws.String("String"),
  1573. Values: []*string{
  1574. aws.String("String"), // Required
  1575. // More values...
  1576. },
  1577. },
  1578. // More values...
  1579. },
  1580. InstanceIds: []*string{
  1581. aws.String("String"), // Required
  1582. // More values...
  1583. },
  1584. MaxResults: aws.Int64(1),
  1585. NextToken: aws.String("String"),
  1586. }
  1587. resp, err := svc.DescribeClassicLinkInstances(params)
  1588. if err != nil {
  1589. // Print the error, cast err to awserr.Error to get the Code and
  1590. // Message from an error.
  1591. fmt.Println(err.Error())
  1592. return
  1593. }
  1594. // Pretty-print the response data.
  1595. fmt.Println(resp)
  1596. }
  1597. func ExampleEC2_DescribeConversionTasks() {
  1598. svc := ec2.New(nil)
  1599. params := &ec2.DescribeConversionTasksInput{
  1600. ConversionTaskIds: []*string{
  1601. aws.String("String"), // Required
  1602. // More values...
  1603. },
  1604. DryRun: aws.Bool(true),
  1605. Filters: []*ec2.Filter{
  1606. { // Required
  1607. Name: aws.String("String"),
  1608. Values: []*string{
  1609. aws.String("String"), // Required
  1610. // More values...
  1611. },
  1612. },
  1613. // More values...
  1614. },
  1615. }
  1616. resp, err := svc.DescribeConversionTasks(params)
  1617. if err != nil {
  1618. // Print the error, cast err to awserr.Error to get the Code and
  1619. // Message from an error.
  1620. fmt.Println(err.Error())
  1621. return
  1622. }
  1623. // Pretty-print the response data.
  1624. fmt.Println(resp)
  1625. }
  1626. func ExampleEC2_DescribeCustomerGateways() {
  1627. svc := ec2.New(nil)
  1628. params := &ec2.DescribeCustomerGatewaysInput{
  1629. CustomerGatewayIds: []*string{
  1630. aws.String("String"), // Required
  1631. // More values...
  1632. },
  1633. DryRun: aws.Bool(true),
  1634. Filters: []*ec2.Filter{
  1635. { // Required
  1636. Name: aws.String("String"),
  1637. Values: []*string{
  1638. aws.String("String"), // Required
  1639. // More values...
  1640. },
  1641. },
  1642. // More values...
  1643. },
  1644. }
  1645. resp, err := svc.DescribeCustomerGateways(params)
  1646. if err != nil {
  1647. // Print the error, cast err to awserr.Error to get the Code and
  1648. // Message from an error.
  1649. fmt.Println(err.Error())
  1650. return
  1651. }
  1652. // Pretty-print the response data.
  1653. fmt.Println(resp)
  1654. }
  1655. func ExampleEC2_DescribeDhcpOptions() {
  1656. svc := ec2.New(nil)
  1657. params := &ec2.DescribeDhcpOptionsInput{
  1658. DhcpOptionsIds: []*string{
  1659. aws.String("String"), // Required
  1660. // More values...
  1661. },
  1662. DryRun: aws.Bool(true),
  1663. Filters: []*ec2.Filter{
  1664. { // Required
  1665. Name: aws.String("String"),
  1666. Values: []*string{
  1667. aws.String("String"), // Required
  1668. // More values...
  1669. },
  1670. },
  1671. // More values...
  1672. },
  1673. }
  1674. resp, err := svc.DescribeDhcpOptions(params)
  1675. if err != nil {
  1676. // Print the error, cast err to awserr.Error to get the Code and
  1677. // Message from an error.
  1678. fmt.Println(err.Error())
  1679. return
  1680. }
  1681. // Pretty-print the response data.
  1682. fmt.Println(resp)
  1683. }
  1684. func ExampleEC2_DescribeExportTasks() {
  1685. svc := ec2.New(nil)
  1686. params := &ec2.DescribeExportTasksInput{
  1687. ExportTaskIds: []*string{
  1688. aws.String("String"), // Required
  1689. // More values...
  1690. },
  1691. }
  1692. resp, err := svc.DescribeExportTasks(params)
  1693. if err != nil {
  1694. // Print the error, cast err to awserr.Error to get the Code and
  1695. // Message from an error.
  1696. fmt.Println(err.Error())
  1697. return
  1698. }
  1699. // Pretty-print the response data.
  1700. fmt.Println(resp)
  1701. }
  1702. func ExampleEC2_DescribeFlowLogs() {
  1703. svc := ec2.New(nil)
  1704. params := &ec2.DescribeFlowLogsInput{
  1705. Filter: []*ec2.Filter{
  1706. { // Required
  1707. Name: aws.String("String"),
  1708. Values: []*string{
  1709. aws.String("String"), // Required
  1710. // More values...
  1711. },
  1712. },
  1713. // More values...
  1714. },
  1715. FlowLogIds: []*string{
  1716. aws.String("String"), // Required
  1717. // More values...
  1718. },
  1719. MaxResults: aws.Int64(1),
  1720. NextToken: aws.String("String"),
  1721. }
  1722. resp, err := svc.DescribeFlowLogs(params)
  1723. if err != nil {
  1724. // Print the error, cast err to awserr.Error to get the Code and
  1725. // Message from an error.
  1726. fmt.Println(err.Error())
  1727. return
  1728. }
  1729. // Pretty-print the response data.
  1730. fmt.Println(resp)
  1731. }
  1732. func ExampleEC2_DescribeImageAttribute() {
  1733. svc := ec2.New(nil)
  1734. params := &ec2.DescribeImageAttributeInput{
  1735. Attribute: aws.String("ImageAttributeName"), // Required
  1736. ImageId: aws.String("String"), // Required
  1737. DryRun: aws.Bool(true),
  1738. }
  1739. resp, err := svc.DescribeImageAttribute(params)
  1740. if err != nil {
  1741. // Print the error, cast err to awserr.Error to get the Code and
  1742. // Message from an error.
  1743. fmt.Println(err.Error())
  1744. return
  1745. }
  1746. // Pretty-print the response data.
  1747. fmt.Println(resp)
  1748. }
  1749. func ExampleEC2_DescribeImages() {
  1750. svc := ec2.New(nil)
  1751. params := &ec2.DescribeImagesInput{
  1752. DryRun: aws.Bool(true),
  1753. ExecutableUsers: []*string{
  1754. aws.String("String"), // Required
  1755. // More values...
  1756. },
  1757. Filters: []*ec2.Filter{
  1758. { // Required
  1759. Name: aws.String("String"),
  1760. Values: []*string{
  1761. aws.String("String"), // Required
  1762. // More values...
  1763. },
  1764. },
  1765. // More values...
  1766. },
  1767. ImageIds: []*string{
  1768. aws.String("String"), // Required
  1769. // More values...
  1770. },
  1771. Owners: []*string{
  1772. aws.String("String"), // Required
  1773. // More values...
  1774. },
  1775. }
  1776. resp, err := svc.DescribeImages(params)
  1777. if err != nil {
  1778. // Print the error, cast err to awserr.Error to get the Code and
  1779. // Message from an error.
  1780. fmt.Println(err.Error())
  1781. return
  1782. }
  1783. // Pretty-print the response data.
  1784. fmt.Println(resp)
  1785. }
  1786. func ExampleEC2_DescribeImportImageTasks() {
  1787. svc := ec2.New(nil)
  1788. params := &ec2.DescribeImportImageTasksInput{
  1789. DryRun: aws.Bool(true),
  1790. Filters: []*ec2.Filter{
  1791. { // Required
  1792. Name: aws.String("String"),
  1793. Values: []*string{
  1794. aws.String("String"), // Required
  1795. // More values...
  1796. },
  1797. },
  1798. // More values...
  1799. },
  1800. ImportTaskIds: []*string{
  1801. aws.String("String"), // Required
  1802. // More values...
  1803. },
  1804. MaxResults: aws.Int64(1),
  1805. NextToken: aws.String("String"),
  1806. }
  1807. resp, err := svc.DescribeImportImageTasks(params)
  1808. if err != nil {
  1809. // Print the error, cast err to awserr.Error to get the Code and
  1810. // Message from an error.
  1811. fmt.Println(err.Error())
  1812. return
  1813. }
  1814. // Pretty-print the response data.
  1815. fmt.Println(resp)
  1816. }
  1817. func ExampleEC2_DescribeImportSnapshotTasks() {
  1818. svc := ec2.New(nil)
  1819. params := &ec2.DescribeImportSnapshotTasksInput{
  1820. DryRun: aws.Bool(true),
  1821. Filters: []*ec2.Filter{
  1822. { // Required
  1823. Name: aws.String("String"),
  1824. Values: []*string{
  1825. aws.String("String"), // Required
  1826. // More values...
  1827. },
  1828. },
  1829. // More values...
  1830. },
  1831. ImportTaskIds: []*string{
  1832. aws.String("String"), // Required
  1833. // More values...
  1834. },
  1835. MaxResults: aws.Int64(1),
  1836. NextToken: aws.String("String"),
  1837. }
  1838. resp, err := svc.DescribeImportSnapshotTasks(params)
  1839. if err != nil {
  1840. // Print the error, cast err to awserr.Error to get the Code and
  1841. // Message from an error.
  1842. fmt.Println(err.Error())
  1843. return
  1844. }
  1845. // Pretty-print the response data.
  1846. fmt.Println(resp)
  1847. }
  1848. func ExampleEC2_DescribeInstanceAttribute() {
  1849. svc := ec2.New(nil)
  1850. params := &ec2.DescribeInstanceAttributeInput{
  1851. Attribute: aws.String("InstanceAttributeName"), // Required
  1852. InstanceId: aws.String("String"), // Required
  1853. DryRun: aws.Bool(true),
  1854. }
  1855. resp, err := svc.DescribeInstanceAttribute(params)
  1856. if err != nil {
  1857. // Print the error, cast err to awserr.Error to get the Code and
  1858. // Message from an error.
  1859. fmt.Println(err.Error())
  1860. return
  1861. }
  1862. // Pretty-print the response data.
  1863. fmt.Println(resp)
  1864. }
  1865. func ExampleEC2_DescribeInstanceStatus() {
  1866. svc := ec2.New(nil)
  1867. params := &ec2.DescribeInstanceStatusInput{
  1868. DryRun: aws.Bool(true),
  1869. Filters: []*ec2.Filter{
  1870. { // Required
  1871. Name: aws.String("String"),
  1872. Values: []*string{
  1873. aws.String("String"), // Required
  1874. // More values...
  1875. },
  1876. },
  1877. // More values...
  1878. },
  1879. IncludeAllInstances: aws.Bool(true),
  1880. InstanceIds: []*string{
  1881. aws.String("String"), // Required
  1882. // More values...
  1883. },
  1884. MaxResults: aws.Int64(1),
  1885. NextToken: aws.String("String"),
  1886. }
  1887. resp, err := svc.DescribeInstanceStatus(params)
  1888. if err != nil {
  1889. // Print the error, cast err to awserr.Error to get the Code and
  1890. // Message from an error.
  1891. fmt.Println(err.Error())
  1892. return
  1893. }
  1894. // Pretty-print the response data.
  1895. fmt.Println(resp)
  1896. }
  1897. func ExampleEC2_DescribeInstances() {
  1898. svc := ec2.New(nil)
  1899. params := &ec2.DescribeInstancesInput{
  1900. DryRun: aws.Bool(true),
  1901. Filters: []*ec2.Filter{
  1902. { // Required
  1903. Name: aws.String("String"),
  1904. Values: []*string{
  1905. aws.String("String"), // Required
  1906. // More values...
  1907. },
  1908. },
  1909. // More values...
  1910. },
  1911. InstanceIds: []*string{
  1912. aws.String("String"), // Required
  1913. // More values...
  1914. },
  1915. MaxResults: aws.Int64(1),
  1916. NextToken: aws.String("String"),
  1917. }
  1918. resp, err := svc.DescribeInstances(params)
  1919. if err != nil {
  1920. // Print the error, cast err to awserr.Error to get the Code and
  1921. // Message from an error.
  1922. fmt.Println(err.Error())
  1923. return
  1924. }
  1925. // Pretty-print the response data.
  1926. fmt.Println(resp)
  1927. }
  1928. func ExampleEC2_DescribeInternetGateways() {
  1929. svc := ec2.New(nil)
  1930. params := &ec2.DescribeInternetGatewaysInput{
  1931. DryRun: aws.Bool(true),
  1932. Filters: []*ec2.Filter{
  1933. { // Required
  1934. Name: aws.String("String"),
  1935. Values: []*string{
  1936. aws.String("String"), // Required
  1937. // More values...
  1938. },
  1939. },
  1940. // More values...
  1941. },
  1942. InternetGatewayIds: []*string{
  1943. aws.String("String"), // Required
  1944. // More values...
  1945. },
  1946. }
  1947. resp, err := svc.DescribeInternetGateways(params)
  1948. if err != nil {
  1949. // Print the error, cast err to awserr.Error to get the Code and
  1950. // Message from an error.
  1951. fmt.Println(err.Error())
  1952. return
  1953. }
  1954. // Pretty-print the response data.
  1955. fmt.Println(resp)
  1956. }
  1957. func ExampleEC2_DescribeKeyPairs() {
  1958. svc := ec2.New(nil)
  1959. params := &ec2.DescribeKeyPairsInput{
  1960. DryRun: aws.Bool(true),
  1961. Filters: []*ec2.Filter{
  1962. { // Required
  1963. Name: aws.String("String"),
  1964. Values: []*string{
  1965. aws.String("String"), // Required
  1966. // More values...
  1967. },
  1968. },
  1969. // More values...
  1970. },
  1971. KeyNames: []*string{
  1972. aws.String("String"), // Required
  1973. // More values...
  1974. },
  1975. }
  1976. resp, err := svc.DescribeKeyPairs(params)
  1977. if err != nil {
  1978. // Print the error, cast err to awserr.Error to get the Code and
  1979. // Message from an error.
  1980. fmt.Println(err.Error())
  1981. return
  1982. }
  1983. // Pretty-print the response data.
  1984. fmt.Println(resp)
  1985. }
  1986. func ExampleEC2_DescribeMovingAddresses() {
  1987. svc := ec2.New(nil)
  1988. params := &ec2.DescribeMovingAddressesInput{
  1989. DryRun: aws.Bool(true),
  1990. Filters: []*ec2.Filter{
  1991. { // Required
  1992. Name: aws.String("String"),
  1993. Values: []*string{
  1994. aws.String("String"), // Required
  1995. // More values...
  1996. },
  1997. },
  1998. // More values...
  1999. },
  2000. MaxResults: aws.Int64(1),
  2001. NextToken: aws.String("String"),
  2002. PublicIps: []*string{
  2003. aws.String("String"), // Required
  2004. // More values...
  2005. },
  2006. }
  2007. resp, err := svc.DescribeMovingAddresses(params)
  2008. if err != nil {
  2009. // Print the error, cast err to awserr.Error to get the Code and
  2010. // Message from an error.
  2011. fmt.Println(err.Error())
  2012. return
  2013. }
  2014. // Pretty-print the response data.
  2015. fmt.Println(resp)
  2016. }
  2017. func ExampleEC2_DescribeNetworkAcls() {
  2018. svc := ec2.New(nil)
  2019. params := &ec2.DescribeNetworkAclsInput{
  2020. DryRun: aws.Bool(true),
  2021. Filters: []*ec2.Filter{
  2022. { // Required
  2023. Name: aws.String("String"),
  2024. Values: []*string{
  2025. aws.String("String"), // Required
  2026. // More values...
  2027. },
  2028. },
  2029. // More values...
  2030. },
  2031. NetworkAclIds: []*string{
  2032. aws.String("String"), // Required
  2033. // More values...
  2034. },
  2035. }
  2036. resp, err := svc.DescribeNetworkAcls(params)
  2037. if err != nil {
  2038. // Print the error, cast err to awserr.Error to get the Code and
  2039. // Message from an error.
  2040. fmt.Println(err.Error())
  2041. return
  2042. }
  2043. // Pretty-print the response data.
  2044. fmt.Println(resp)
  2045. }
  2046. func ExampleEC2_DescribeNetworkInterfaceAttribute() {
  2047. svc := ec2.New(nil)
  2048. params := &ec2.DescribeNetworkInterfaceAttributeInput{
  2049. NetworkInterfaceId: aws.String("String"), // Required
  2050. Attribute: aws.String("NetworkInterfaceAttribute"),
  2051. DryRun: aws.Bool(true),
  2052. }
  2053. resp, err := svc.DescribeNetworkInterfaceAttribute(params)
  2054. if err != nil {
  2055. // Print the error, cast err to awserr.Error to get the Code and
  2056. // Message from an error.
  2057. fmt.Println(err.Error())
  2058. return
  2059. }
  2060. // Pretty-print the response data.
  2061. fmt.Println(resp)
  2062. }
  2063. func ExampleEC2_DescribeNetworkInterfaces() {
  2064. svc := ec2.New(nil)
  2065. params := &ec2.DescribeNetworkInterfacesInput{
  2066. DryRun: aws.Bool(true),
  2067. Filters: []*ec2.Filter{
  2068. { // Required
  2069. Name: aws.String("String"),
  2070. Values: []*string{
  2071. aws.String("String"), // Required
  2072. // More values...
  2073. },
  2074. },
  2075. // More values...
  2076. },
  2077. NetworkInterfaceIds: []*string{
  2078. aws.String("String"), // Required
  2079. // More values...
  2080. },
  2081. }
  2082. resp, err := svc.DescribeNetworkInterfaces(params)
  2083. if err != nil {
  2084. // Print the error, cast err to awserr.Error to get the Code and
  2085. // Message from an error.
  2086. fmt.Println(err.Error())
  2087. return
  2088. }
  2089. // Pretty-print the response data.
  2090. fmt.Println(resp)
  2091. }
  2092. func ExampleEC2_DescribePlacementGroups() {
  2093. svc := ec2.New(nil)
  2094. params := &ec2.DescribePlacementGroupsInput{
  2095. DryRun: aws.Bool(true),
  2096. Filters: []*ec2.Filter{
  2097. { // Required
  2098. Name: aws.String("String"),
  2099. Values: []*string{
  2100. aws.String("String"), // Required
  2101. // More values...
  2102. },
  2103. },
  2104. // More values...
  2105. },
  2106. GroupNames: []*string{
  2107. aws.String("String"), // Required
  2108. // More values...
  2109. },
  2110. }
  2111. resp, err := svc.DescribePlacementGroups(params)
  2112. if err != nil {
  2113. // Print the error, cast err to awserr.Error to get the Code and
  2114. // Message from an error.
  2115. fmt.Println(err.Error())
  2116. return
  2117. }
  2118. // Pretty-print the response data.
  2119. fmt.Println(resp)
  2120. }
  2121. func ExampleEC2_DescribePrefixLists() {
  2122. svc := ec2.New(nil)
  2123. params := &ec2.DescribePrefixListsInput{
  2124. DryRun: aws.Bool(true),
  2125. Filters: []*ec2.Filter{
  2126. { // Required
  2127. Name: aws.String("String"),
  2128. Values: []*string{
  2129. aws.String("String"), // Required
  2130. // More values...
  2131. },
  2132. },
  2133. // More values...
  2134. },
  2135. MaxResults: aws.Int64(1),
  2136. NextToken: aws.String("String"),
  2137. PrefixListIds: []*string{
  2138. aws.String("String"), // Required
  2139. // More values...
  2140. },
  2141. }
  2142. resp, err := svc.DescribePrefixLists(params)
  2143. if err != nil {
  2144. // Print the error, cast err to awserr.Error to get the Code and
  2145. // Message from an error.
  2146. fmt.Println(err.Error())
  2147. return
  2148. }
  2149. // Pretty-print the response data.
  2150. fmt.Println(resp)
  2151. }
  2152. func ExampleEC2_DescribeRegions() {
  2153. svc := ec2.New(nil)
  2154. params := &ec2.DescribeRegionsInput{
  2155. DryRun: aws.Bool(true),
  2156. Filters: []*ec2.Filter{
  2157. { // Required
  2158. Name: aws.String("String"),
  2159. Values: []*string{
  2160. aws.String("String"), // Required
  2161. // More values...
  2162. },
  2163. },
  2164. // More values...
  2165. },
  2166. RegionNames: []*string{
  2167. aws.String("String"), // Required
  2168. // More values...
  2169. },
  2170. }
  2171. resp, err := svc.DescribeRegions(params)
  2172. if err != nil {
  2173. // Print the error, cast err to awserr.Error to get the Code and
  2174. // Message from an error.
  2175. fmt.Println(err.Error())
  2176. return
  2177. }
  2178. // Pretty-print the response data.
  2179. fmt.Println(resp)
  2180. }
  2181. func ExampleEC2_DescribeReservedInstances() {
  2182. svc := ec2.New(nil)
  2183. params := &ec2.DescribeReservedInstancesInput{
  2184. DryRun: aws.Bool(true),
  2185. Filters: []*ec2.Filter{
  2186. { // Required
  2187. Name: aws.String("String"),
  2188. Values: []*string{
  2189. aws.String("String"), // Required
  2190. // More values...
  2191. },
  2192. },
  2193. // More values...
  2194. },
  2195. OfferingType: aws.String("OfferingTypeValues"),
  2196. ReservedInstancesIds: []*string{
  2197. aws.String("String"), // Required
  2198. // More values...
  2199. },
  2200. }
  2201. resp, err := svc.DescribeReservedInstances(params)
  2202. if err != nil {
  2203. // Print the error, cast err to awserr.Error to get the Code and
  2204. // Message from an error.
  2205. fmt.Println(err.Error())
  2206. return
  2207. }
  2208. // Pretty-print the response data.
  2209. fmt.Println(resp)
  2210. }
  2211. func ExampleEC2_DescribeReservedInstancesListings() {
  2212. svc := ec2.New(nil)
  2213. params := &ec2.DescribeReservedInstancesListingsInput{
  2214. Filters: []*ec2.Filter{
  2215. { // Required
  2216. Name: aws.String("String"),
  2217. Values: []*string{
  2218. aws.String("String"), // Required
  2219. // More values...
  2220. },
  2221. },
  2222. // More values...
  2223. },
  2224. ReservedInstancesId: aws.String("String"),
  2225. ReservedInstancesListingId: aws.String("String"),
  2226. }
  2227. resp, err := svc.DescribeReservedInstancesListings(params)
  2228. if err != nil {
  2229. // Print the error, cast err to awserr.Error to get the Code and
  2230. // Message from an error.
  2231. fmt.Println(err.Error())
  2232. return
  2233. }
  2234. // Pretty-print the response data.
  2235. fmt.Println(resp)
  2236. }
  2237. func ExampleEC2_DescribeReservedInstancesModifications() {
  2238. svc := ec2.New(nil)
  2239. params := &ec2.DescribeReservedInstancesModificationsInput{
  2240. Filters: []*ec2.Filter{
  2241. { // Required
  2242. Name: aws.String("String"),
  2243. Values: []*string{
  2244. aws.String("String"), // Required
  2245. // More values...
  2246. },
  2247. },
  2248. // More values...
  2249. },
  2250. NextToken: aws.String("String"),
  2251. ReservedInstancesModificationIds: []*string{
  2252. aws.String("String"), // Required
  2253. // More values...
  2254. },
  2255. }
  2256. resp, err := svc.DescribeReservedInstancesModifications(params)
  2257. if err != nil {
  2258. // Print the error, cast err to awserr.Error to get the Code and
  2259. // Message from an error.
  2260. fmt.Println(err.Error())
  2261. return
  2262. }
  2263. // Pretty-print the response data.
  2264. fmt.Println(resp)
  2265. }
  2266. func ExampleEC2_DescribeReservedInstancesOfferings() {
  2267. svc := ec2.New(nil)
  2268. params := &ec2.DescribeReservedInstancesOfferingsInput{
  2269. AvailabilityZone: aws.String("String"),
  2270. DryRun: aws.Bool(true),
  2271. Filters: []*ec2.Filter{
  2272. { // Required
  2273. Name: aws.String("String"),
  2274. Values: []*string{
  2275. aws.String("String"), // Required
  2276. // More values...
  2277. },
  2278. },
  2279. // More values...
  2280. },
  2281. IncludeMarketplace: aws.Bool(true),
  2282. InstanceTenancy: aws.String("Tenancy"),
  2283. InstanceType: aws.String("InstanceType"),
  2284. MaxDuration: aws.Int64(1),
  2285. MaxInstanceCount: aws.Int64(1),
  2286. MaxResults: aws.Int64(1),
  2287. MinDuration: aws.Int64(1),
  2288. NextToken: aws.String("String"),
  2289. OfferingType: aws.String("OfferingTypeValues"),
  2290. ProductDescription: aws.String("RIProductDescription"),
  2291. ReservedInstancesOfferingIds: []*string{
  2292. aws.String("String"), // Required
  2293. // More values...
  2294. },
  2295. }
  2296. resp, err := svc.DescribeReservedInstancesOfferings(params)
  2297. if err != nil {
  2298. // Print the error, cast err to awserr.Error to get the Code and
  2299. // Message from an error.
  2300. fmt.Println(err.Error())
  2301. return
  2302. }
  2303. // Pretty-print the response data.
  2304. fmt.Println(resp)
  2305. }
  2306. func ExampleEC2_DescribeRouteTables() {
  2307. svc := ec2.New(nil)
  2308. params := &ec2.DescribeRouteTablesInput{
  2309. DryRun: aws.Bool(true),
  2310. Filters: []*ec2.Filter{
  2311. { // Required
  2312. Name: aws.String("String"),
  2313. Values: []*string{
  2314. aws.String("String"), // Required
  2315. // More values...
  2316. },
  2317. },
  2318. // More values...
  2319. },
  2320. RouteTableIds: []*string{
  2321. aws.String("String"), // Required
  2322. // More values...
  2323. },
  2324. }
  2325. resp, err := svc.DescribeRouteTables(params)
  2326. if err != nil {
  2327. // Print the error, cast err to awserr.Error to get the Code and
  2328. // Message from an error.
  2329. fmt.Println(err.Error())
  2330. return
  2331. }
  2332. // Pretty-print the response data.
  2333. fmt.Println(resp)
  2334. }
  2335. func ExampleEC2_DescribeSecurityGroups() {
  2336. svc := ec2.New(nil)
  2337. params := &ec2.DescribeSecurityGroupsInput{
  2338. DryRun: aws.Bool(true),
  2339. Filters: []*ec2.Filter{
  2340. { // Required
  2341. Name: aws.String("String"),
  2342. Values: []*string{
  2343. aws.String("String"), // Required
  2344. // More values...
  2345. },
  2346. },
  2347. // More values...
  2348. },
  2349. GroupIds: []*string{
  2350. aws.String("String"), // Required
  2351. // More values...
  2352. },
  2353. GroupNames: []*string{
  2354. aws.String("String"), // Required
  2355. // More values...
  2356. },
  2357. }
  2358. resp, err := svc.DescribeSecurityGroups(params)
  2359. if err != nil {
  2360. // Print the error, cast err to awserr.Error to get the Code and
  2361. // Message from an error.
  2362. fmt.Println(err.Error())
  2363. return
  2364. }
  2365. // Pretty-print the response data.
  2366. fmt.Println(resp)
  2367. }
  2368. func ExampleEC2_DescribeSnapshotAttribute() {
  2369. svc := ec2.New(nil)
  2370. params := &ec2.DescribeSnapshotAttributeInput{
  2371. Attribute: aws.String("SnapshotAttributeName"), // Required
  2372. SnapshotId: aws.String("String"), // Required
  2373. DryRun: aws.Bool(true),
  2374. }
  2375. resp, err := svc.DescribeSnapshotAttribute(params)
  2376. if err != nil {
  2377. // Print the error, cast err to awserr.Error to get the Code and
  2378. // Message from an error.
  2379. fmt.Println(err.Error())
  2380. return
  2381. }
  2382. // Pretty-print the response data.
  2383. fmt.Println(resp)
  2384. }
  2385. func ExampleEC2_DescribeSnapshots() {
  2386. svc := ec2.New(nil)
  2387. params := &ec2.DescribeSnapshotsInput{
  2388. DryRun: aws.Bool(true),
  2389. Filters: []*ec2.Filter{
  2390. { // Required
  2391. Name: aws.String("String"),
  2392. Values: []*string{
  2393. aws.String("String"), // Required
  2394. // More values...
  2395. },
  2396. },
  2397. // More values...
  2398. },
  2399. MaxResults: aws.Int64(1),
  2400. NextToken: aws.String("String"),
  2401. OwnerIds: []*string{
  2402. aws.String("String"), // Required
  2403. // More values...
  2404. },
  2405. RestorableByUserIds: []*string{
  2406. aws.String("String"), // Required
  2407. // More values...
  2408. },
  2409. SnapshotIds: []*string{
  2410. aws.String("String"), // Required
  2411. // More values...
  2412. },
  2413. }
  2414. resp, err := svc.DescribeSnapshots(params)
  2415. if err != nil {
  2416. // Print the error, cast err to awserr.Error to get the Code and
  2417. // Message from an error.
  2418. fmt.Println(err.Error())
  2419. return
  2420. }
  2421. // Pretty-print the response data.
  2422. fmt.Println(resp)
  2423. }
  2424. func ExampleEC2_DescribeSpotDatafeedSubscription() {
  2425. svc := ec2.New(nil)
  2426. params := &ec2.DescribeSpotDatafeedSubscriptionInput{
  2427. DryRun: aws.Bool(true),
  2428. }
  2429. resp, err := svc.DescribeSpotDatafeedSubscription(params)
  2430. if err != nil {
  2431. // Print the error, cast err to awserr.Error to get the Code and
  2432. // Message from an error.
  2433. fmt.Println(err.Error())
  2434. return
  2435. }
  2436. // Pretty-print the response data.
  2437. fmt.Println(resp)
  2438. }
  2439. func ExampleEC2_DescribeSpotFleetInstances() {
  2440. svc := ec2.New(nil)
  2441. params := &ec2.DescribeSpotFleetInstancesInput{
  2442. SpotFleetRequestId: aws.String("String"), // Required
  2443. DryRun: aws.Bool(true),
  2444. MaxResults: aws.Int64(1),
  2445. NextToken: aws.String("String"),
  2446. }
  2447. resp, err := svc.DescribeSpotFleetInstances(params)
  2448. if err != nil {
  2449. // Print the error, cast err to awserr.Error to get the Code and
  2450. // Message from an error.
  2451. fmt.Println(err.Error())
  2452. return
  2453. }
  2454. // Pretty-print the response data.
  2455. fmt.Println(resp)
  2456. }
  2457. func ExampleEC2_DescribeSpotFleetRequestHistory() {
  2458. svc := ec2.New(nil)
  2459. params := &ec2.DescribeSpotFleetRequestHistoryInput{
  2460. SpotFleetRequestId: aws.String("String"), // Required
  2461. StartTime: aws.Time(time.Now()), // Required
  2462. DryRun: aws.Bool(true),
  2463. EventType: aws.String("EventType"),
  2464. MaxResults: aws.Int64(1),
  2465. NextToken: aws.String("String"),
  2466. }
  2467. resp, err := svc.DescribeSpotFleetRequestHistory(params)
  2468. if err != nil {
  2469. // Print the error, cast err to awserr.Error to get the Code and
  2470. // Message from an error.
  2471. fmt.Println(err.Error())
  2472. return
  2473. }
  2474. // Pretty-print the response data.
  2475. fmt.Println(resp)
  2476. }
  2477. func ExampleEC2_DescribeSpotFleetRequests() {
  2478. svc := ec2.New(nil)
  2479. params := &ec2.DescribeSpotFleetRequestsInput{
  2480. DryRun: aws.Bool(true),
  2481. MaxResults: aws.Int64(1),
  2482. NextToken: aws.String("String"),
  2483. SpotFleetRequestIds: []*string{
  2484. aws.String("String"), // Required
  2485. // More values...
  2486. },
  2487. }
  2488. resp, err := svc.DescribeSpotFleetRequests(params)
  2489. if err != nil {
  2490. // Print the error, cast err to awserr.Error to get the Code and
  2491. // Message from an error.
  2492. fmt.Println(err.Error())
  2493. return
  2494. }
  2495. // Pretty-print the response data.
  2496. fmt.Println(resp)
  2497. }
  2498. func ExampleEC2_DescribeSpotInstanceRequests() {
  2499. svc := ec2.New(nil)
  2500. params := &ec2.DescribeSpotInstanceRequestsInput{
  2501. DryRun: aws.Bool(true),
  2502. Filters: []*ec2.Filter{
  2503. { // Required
  2504. Name: aws.String("String"),
  2505. Values: []*string{
  2506. aws.String("String"), // Required
  2507. // More values...
  2508. },
  2509. },
  2510. // More values...
  2511. },
  2512. SpotInstanceRequestIds: []*string{
  2513. aws.String("String"), // Required
  2514. // More values...
  2515. },
  2516. }
  2517. resp, err := svc.DescribeSpotInstanceRequests(params)
  2518. if err != nil {
  2519. // Print the error, cast err to awserr.Error to get the Code and
  2520. // Message from an error.
  2521. fmt.Println(err.Error())
  2522. return
  2523. }
  2524. // Pretty-print the response data.
  2525. fmt.Println(resp)
  2526. }
  2527. func ExampleEC2_DescribeSpotPriceHistory() {
  2528. svc := ec2.New(nil)
  2529. params := &ec2.DescribeSpotPriceHistoryInput{
  2530. AvailabilityZone: aws.String("String"),
  2531. DryRun: aws.Bool(true),
  2532. EndTime: aws.Time(time.Now()),
  2533. Filters: []*ec2.Filter{
  2534. { // Required
  2535. Name: aws.String("String"),
  2536. Values: []*string{
  2537. aws.String("String"), // Required
  2538. // More values...
  2539. },
  2540. },
  2541. // More values...
  2542. },
  2543. InstanceTypes: []*string{
  2544. aws.String("InstanceType"), // Required
  2545. // More values...
  2546. },
  2547. MaxResults: aws.Int64(1),
  2548. NextToken: aws.String("String"),
  2549. ProductDescriptions: []*string{
  2550. aws.String("String"), // Required
  2551. // More values...
  2552. },
  2553. StartTime: aws.Time(time.Now()),
  2554. }
  2555. resp, err := svc.DescribeSpotPriceHistory(params)
  2556. if err != nil {
  2557. // Print the error, cast err to awserr.Error to get the Code and
  2558. // Message from an error.
  2559. fmt.Println(err.Error())
  2560. return
  2561. }
  2562. // Pretty-print the response data.
  2563. fmt.Println(resp)
  2564. }
  2565. func ExampleEC2_DescribeSubnets() {
  2566. svc := ec2.New(nil)
  2567. params := &ec2.DescribeSubnetsInput{
  2568. DryRun: aws.Bool(true),
  2569. Filters: []*ec2.Filter{
  2570. { // Required
  2571. Name: aws.String("String"),
  2572. Values: []*string{
  2573. aws.String("String"), // Required
  2574. // More values...
  2575. },
  2576. },
  2577. // More values...
  2578. },
  2579. SubnetIds: []*string{
  2580. aws.String("String"), // Required
  2581. // More values...
  2582. },
  2583. }
  2584. resp, err := svc.DescribeSubnets(params)
  2585. if err != nil {
  2586. // Print the error, cast err to awserr.Error to get the Code and
  2587. // Message from an error.
  2588. fmt.Println(err.Error())
  2589. return
  2590. }
  2591. // Pretty-print the response data.
  2592. fmt.Println(resp)
  2593. }
  2594. func ExampleEC2_DescribeTags() {
  2595. svc := ec2.New(nil)
  2596. params := &ec2.DescribeTagsInput{
  2597. DryRun: aws.Bool(true),
  2598. Filters: []*ec2.Filter{
  2599. { // Required
  2600. Name: aws.String("String"),
  2601. Values: []*string{
  2602. aws.String("String"), // Required
  2603. // More values...
  2604. },
  2605. },
  2606. // More values...
  2607. },
  2608. MaxResults: aws.Int64(1),
  2609. NextToken: aws.String("String"),
  2610. }
  2611. resp, err := svc.DescribeTags(params)
  2612. if err != nil {
  2613. // Print the error, cast err to awserr.Error to get the Code and
  2614. // Message from an error.
  2615. fmt.Println(err.Error())
  2616. return
  2617. }
  2618. // Pretty-print the response data.
  2619. fmt.Println(resp)
  2620. }
  2621. func ExampleEC2_DescribeVolumeAttribute() {
  2622. svc := ec2.New(nil)
  2623. params := &ec2.DescribeVolumeAttributeInput{
  2624. VolumeId: aws.String("String"), // Required
  2625. Attribute: aws.String("VolumeAttributeName"),
  2626. DryRun: aws.Bool(true),
  2627. }
  2628. resp, err := svc.DescribeVolumeAttribute(params)
  2629. if err != nil {
  2630. // Print the error, cast err to awserr.Error to get the Code and
  2631. // Message from an error.
  2632. fmt.Println(err.Error())
  2633. return
  2634. }
  2635. // Pretty-print the response data.
  2636. fmt.Println(resp)
  2637. }
  2638. func ExampleEC2_DescribeVolumeStatus() {
  2639. svc := ec2.New(nil)
  2640. params := &ec2.DescribeVolumeStatusInput{
  2641. DryRun: aws.Bool(true),
  2642. Filters: []*ec2.Filter{
  2643. { // Required
  2644. Name: aws.String("String"),
  2645. Values: []*string{
  2646. aws.String("String"), // Required
  2647. // More values...
  2648. },
  2649. },
  2650. // More values...
  2651. },
  2652. MaxResults: aws.Int64(1),
  2653. NextToken: aws.String("String"),
  2654. VolumeIds: []*string{
  2655. aws.String("String"), // Required
  2656. // More values...
  2657. },
  2658. }
  2659. resp, err := svc.DescribeVolumeStatus(params)
  2660. if err != nil {
  2661. // Print the error, cast err to awserr.Error to get the Code and
  2662. // Message from an error.
  2663. fmt.Println(err.Error())
  2664. return
  2665. }
  2666. // Pretty-print the response data.
  2667. fmt.Println(resp)
  2668. }
  2669. func ExampleEC2_DescribeVolumes() {
  2670. svc := ec2.New(nil)
  2671. params := &ec2.DescribeVolumesInput{
  2672. DryRun: aws.Bool(true),
  2673. Filters: []*ec2.Filter{
  2674. { // Required
  2675. Name: aws.String("String"),
  2676. Values: []*string{
  2677. aws.String("String"), // Required
  2678. // More values...
  2679. },
  2680. },
  2681. // More values...
  2682. },
  2683. MaxResults: aws.Int64(1),
  2684. NextToken: aws.String("String"),
  2685. VolumeIds: []*string{
  2686. aws.String("String"), // Required
  2687. // More values...
  2688. },
  2689. }
  2690. resp, err := svc.DescribeVolumes(params)
  2691. if err != nil {
  2692. // Print the error, cast err to awserr.Error to get the Code and
  2693. // Message from an error.
  2694. fmt.Println(err.Error())
  2695. return
  2696. }
  2697. // Pretty-print the response data.
  2698. fmt.Println(resp)
  2699. }
  2700. func ExampleEC2_DescribeVpcAttribute() {
  2701. svc := ec2.New(nil)
  2702. params := &ec2.DescribeVpcAttributeInput{
  2703. VpcId: aws.String("String"), // Required
  2704. Attribute: aws.String("VpcAttributeName"),
  2705. DryRun: aws.Bool(true),
  2706. }
  2707. resp, err := svc.DescribeVpcAttribute(params)
  2708. if err != nil {
  2709. // Print the error, cast err to awserr.Error to get the Code and
  2710. // Message from an error.
  2711. fmt.Println(err.Error())
  2712. return
  2713. }
  2714. // Pretty-print the response data.
  2715. fmt.Println(resp)
  2716. }
  2717. func ExampleEC2_DescribeVpcClassicLink() {
  2718. svc := ec2.New(nil)
  2719. params := &ec2.DescribeVpcClassicLinkInput{
  2720. DryRun: aws.Bool(true),
  2721. Filters: []*ec2.Filter{
  2722. { // Required
  2723. Name: aws.String("String"),
  2724. Values: []*string{
  2725. aws.String("String"), // Required
  2726. // More values...
  2727. },
  2728. },
  2729. // More values...
  2730. },
  2731. VpcIds: []*string{
  2732. aws.String("String"), // Required
  2733. // More values...
  2734. },
  2735. }
  2736. resp, err := svc.DescribeVpcClassicLink(params)
  2737. if err != nil {
  2738. // Print the error, cast err to awserr.Error to get the Code and
  2739. // Message from an error.
  2740. fmt.Println(err.Error())
  2741. return
  2742. }
  2743. // Pretty-print the response data.
  2744. fmt.Println(resp)
  2745. }
  2746. func ExampleEC2_DescribeVpcEndpointServices() {
  2747. svc := ec2.New(nil)
  2748. params := &ec2.DescribeVpcEndpointServicesInput{
  2749. DryRun: aws.Bool(true),
  2750. MaxResults: aws.Int64(1),
  2751. NextToken: aws.String("String"),
  2752. }
  2753. resp, err := svc.DescribeVpcEndpointServices(params)
  2754. if err != nil {
  2755. // Print the error, cast err to awserr.Error to get the Code and
  2756. // Message from an error.
  2757. fmt.Println(err.Error())
  2758. return
  2759. }
  2760. // Pretty-print the response data.
  2761. fmt.Println(resp)
  2762. }
  2763. func ExampleEC2_DescribeVpcEndpoints() {
  2764. svc := ec2.New(nil)
  2765. params := &ec2.DescribeVpcEndpointsInput{
  2766. DryRun: aws.Bool(true),
  2767. Filters: []*ec2.Filter{
  2768. { // Required
  2769. Name: aws.String("String"),
  2770. Values: []*string{
  2771. aws.String("String"), // Required
  2772. // More values...
  2773. },
  2774. },
  2775. // More values...
  2776. },
  2777. MaxResults: aws.Int64(1),
  2778. NextToken: aws.String("String"),
  2779. VpcEndpointIds: []*string{
  2780. aws.String("String"), // Required
  2781. // More values...
  2782. },
  2783. }
  2784. resp, err := svc.DescribeVpcEndpoints(params)
  2785. if err != nil {
  2786. // Print the error, cast err to awserr.Error to get the Code and
  2787. // Message from an error.
  2788. fmt.Println(err.Error())
  2789. return
  2790. }
  2791. // Pretty-print the response data.
  2792. fmt.Println(resp)
  2793. }
  2794. func ExampleEC2_DescribeVpcPeeringConnections() {
  2795. svc := ec2.New(nil)
  2796. params := &ec2.DescribeVpcPeeringConnectionsInput{
  2797. DryRun: aws.Bool(true),
  2798. Filters: []*ec2.Filter{
  2799. { // Required
  2800. Name: aws.String("String"),
  2801. Values: []*string{
  2802. aws.String("String"), // Required
  2803. // More values...
  2804. },
  2805. },
  2806. // More values...
  2807. },
  2808. VpcPeeringConnectionIds: []*string{
  2809. aws.String("String"), // Required
  2810. // More values...
  2811. },
  2812. }
  2813. resp, err := svc.DescribeVpcPeeringConnections(params)
  2814. if err != nil {
  2815. // Print the error, cast err to awserr.Error to get the Code and
  2816. // Message from an error.
  2817. fmt.Println(err.Error())
  2818. return
  2819. }
  2820. // Pretty-print the response data.
  2821. fmt.Println(resp)
  2822. }
  2823. func ExampleEC2_DescribeVpcs() {
  2824. svc := ec2.New(nil)
  2825. params := &ec2.DescribeVpcsInput{
  2826. DryRun: aws.Bool(true),
  2827. Filters: []*ec2.Filter{
  2828. { // Required
  2829. Name: aws.String("String"),
  2830. Values: []*string{
  2831. aws.String("String"), // Required
  2832. // More values...
  2833. },
  2834. },
  2835. // More values...
  2836. },
  2837. VpcIds: []*string{
  2838. aws.String("String"), // Required
  2839. // More values...
  2840. },
  2841. }
  2842. resp, err := svc.DescribeVpcs(params)
  2843. if err != nil {
  2844. // Print the error, cast err to awserr.Error to get the Code and
  2845. // Message from an error.
  2846. fmt.Println(err.Error())
  2847. return
  2848. }
  2849. // Pretty-print the response data.
  2850. fmt.Println(resp)
  2851. }
  2852. func ExampleEC2_DescribeVpnConnections() {
  2853. svc := ec2.New(nil)
  2854. params := &ec2.DescribeVpnConnectionsInput{
  2855. DryRun: aws.Bool(true),
  2856. Filters: []*ec2.Filter{
  2857. { // Required
  2858. Name: aws.String("String"),
  2859. Values: []*string{
  2860. aws.String("String"), // Required
  2861. // More values...
  2862. },
  2863. },
  2864. // More values...
  2865. },
  2866. VpnConnectionIds: []*string{
  2867. aws.String("String"), // Required
  2868. // More values...
  2869. },
  2870. }
  2871. resp, err := svc.DescribeVpnConnections(params)
  2872. if err != nil {
  2873. // Print the error, cast err to awserr.Error to get the Code and
  2874. // Message from an error.
  2875. fmt.Println(err.Error())
  2876. return
  2877. }
  2878. // Pretty-print the response data.
  2879. fmt.Println(resp)
  2880. }
  2881. func ExampleEC2_DescribeVpnGateways() {
  2882. svc := ec2.New(nil)
  2883. params := &ec2.DescribeVpnGatewaysInput{
  2884. DryRun: aws.Bool(true),
  2885. Filters: []*ec2.Filter{
  2886. { // Required
  2887. Name: aws.String("String"),
  2888. Values: []*string{
  2889. aws.String("String"), // Required
  2890. // More values...
  2891. },
  2892. },
  2893. // More values...
  2894. },
  2895. VpnGatewayIds: []*string{
  2896. aws.String("String"), // Required
  2897. // More values...
  2898. },
  2899. }
  2900. resp, err := svc.DescribeVpnGateways(params)
  2901. if err != nil {
  2902. // Print the error, cast err to awserr.Error to get the Code and
  2903. // Message from an error.
  2904. fmt.Println(err.Error())
  2905. return
  2906. }
  2907. // Pretty-print the response data.
  2908. fmt.Println(resp)
  2909. }
  2910. func ExampleEC2_DetachClassicLinkVpc() {
  2911. svc := ec2.New(nil)
  2912. params := &ec2.DetachClassicLinkVpcInput{
  2913. InstanceId: aws.String("String"), // Required
  2914. VpcId: aws.String("String"), // Required
  2915. DryRun: aws.Bool(true),
  2916. }
  2917. resp, err := svc.DetachClassicLinkVpc(params)
  2918. if err != nil {
  2919. // Print the error, cast err to awserr.Error to get the Code and
  2920. // Message from an error.
  2921. fmt.Println(err.Error())
  2922. return
  2923. }
  2924. // Pretty-print the response data.
  2925. fmt.Println(resp)
  2926. }
  2927. func ExampleEC2_DetachInternetGateway() {
  2928. svc := ec2.New(nil)
  2929. params := &ec2.DetachInternetGatewayInput{
  2930. InternetGatewayId: aws.String("String"), // Required
  2931. VpcId: aws.String("String"), // Required
  2932. DryRun: aws.Bool(true),
  2933. }
  2934. resp, err := svc.DetachInternetGateway(params)
  2935. if err != nil {
  2936. // Print the error, cast err to awserr.Error to get the Code and
  2937. // Message from an error.
  2938. fmt.Println(err.Error())
  2939. return
  2940. }
  2941. // Pretty-print the response data.
  2942. fmt.Println(resp)
  2943. }
  2944. func ExampleEC2_DetachNetworkInterface() {
  2945. svc := ec2.New(nil)
  2946. params := &ec2.DetachNetworkInterfaceInput{
  2947. AttachmentId: aws.String("String"), // Required
  2948. DryRun: aws.Bool(true),
  2949. Force: aws.Bool(true),
  2950. }
  2951. resp, err := svc.DetachNetworkInterface(params)
  2952. if err != nil {
  2953. // Print the error, cast err to awserr.Error to get the Code and
  2954. // Message from an error.
  2955. fmt.Println(err.Error())
  2956. return
  2957. }
  2958. // Pretty-print the response data.
  2959. fmt.Println(resp)
  2960. }
  2961. func ExampleEC2_DetachVolume() {
  2962. svc := ec2.New(nil)
  2963. params := &ec2.DetachVolumeInput{
  2964. VolumeId: aws.String("String"), // Required
  2965. Device: aws.String("String"),
  2966. DryRun: aws.Bool(true),
  2967. Force: aws.Bool(true),
  2968. InstanceId: aws.String("String"),
  2969. }
  2970. resp, err := svc.DetachVolume(params)
  2971. if err != nil {
  2972. // Print the error, cast err to awserr.Error to get the Code and
  2973. // Message from an error.
  2974. fmt.Println(err.Error())
  2975. return
  2976. }
  2977. // Pretty-print the response data.
  2978. fmt.Println(resp)
  2979. }
  2980. func ExampleEC2_DetachVpnGateway() {
  2981. svc := ec2.New(nil)
  2982. params := &ec2.DetachVpnGatewayInput{
  2983. VpcId: aws.String("String"), // Required
  2984. VpnGatewayId: aws.String("String"), // Required
  2985. DryRun: aws.Bool(true),
  2986. }
  2987. resp, err := svc.DetachVpnGateway(params)
  2988. if err != nil {
  2989. // Print the error, cast err to awserr.Error to get the Code and
  2990. // Message from an error.
  2991. fmt.Println(err.Error())
  2992. return
  2993. }
  2994. // Pretty-print the response data.
  2995. fmt.Println(resp)
  2996. }
  2997. func ExampleEC2_DisableVgwRoutePropagation() {
  2998. svc := ec2.New(nil)
  2999. params := &ec2.DisableVgwRoutePropagationInput{
  3000. GatewayId: aws.String("String"), // Required
  3001. RouteTableId: aws.String("String"), // Required
  3002. }
  3003. resp, err := svc.DisableVgwRoutePropagation(params)
  3004. if err != nil {
  3005. // Print the error, cast err to awserr.Error to get the Code and
  3006. // Message from an error.
  3007. fmt.Println(err.Error())
  3008. return
  3009. }
  3010. // Pretty-print the response data.
  3011. fmt.Println(resp)
  3012. }
  3013. func ExampleEC2_DisableVpcClassicLink() {
  3014. svc := ec2.New(nil)
  3015. params := &ec2.DisableVpcClassicLinkInput{
  3016. VpcId: aws.String("String"), // Required
  3017. DryRun: aws.Bool(true),
  3018. }
  3019. resp, err := svc.DisableVpcClassicLink(params)
  3020. if err != nil {
  3021. // Print the error, cast err to awserr.Error to get the Code and
  3022. // Message from an error.
  3023. fmt.Println(err.Error())
  3024. return
  3025. }
  3026. // Pretty-print the response data.
  3027. fmt.Println(resp)
  3028. }
  3029. func ExampleEC2_DisassociateAddress() {
  3030. svc := ec2.New(nil)
  3031. params := &ec2.DisassociateAddressInput{
  3032. AssociationId: aws.String("String"),
  3033. DryRun: aws.Bool(true),
  3034. PublicIp: aws.String("String"),
  3035. }
  3036. resp, err := svc.DisassociateAddress(params)
  3037. if err != nil {
  3038. // Print the error, cast err to awserr.Error to get the Code and
  3039. // Message from an error.
  3040. fmt.Println(err.Error())
  3041. return
  3042. }
  3043. // Pretty-print the response data.
  3044. fmt.Println(resp)
  3045. }
  3046. func ExampleEC2_DisassociateRouteTable() {
  3047. svc := ec2.New(nil)
  3048. params := &ec2.DisassociateRouteTableInput{
  3049. AssociationId: aws.String("String"), // Required
  3050. DryRun: aws.Bool(true),
  3051. }
  3052. resp, err := svc.DisassociateRouteTable(params)
  3053. if err != nil {
  3054. // Print the error, cast err to awserr.Error to get the Code and
  3055. // Message from an error.
  3056. fmt.Println(err.Error())
  3057. return
  3058. }
  3059. // Pretty-print the response data.
  3060. fmt.Println(resp)
  3061. }
  3062. func ExampleEC2_EnableVgwRoutePropagation() {
  3063. svc := ec2.New(nil)
  3064. params := &ec2.EnableVgwRoutePropagationInput{
  3065. GatewayId: aws.String("String"), // Required
  3066. RouteTableId: aws.String("String"), // Required
  3067. }
  3068. resp, err := svc.EnableVgwRoutePropagation(params)
  3069. if err != nil {
  3070. // Print the error, cast err to awserr.Error to get the Code and
  3071. // Message from an error.
  3072. fmt.Println(err.Error())
  3073. return
  3074. }
  3075. // Pretty-print the response data.
  3076. fmt.Println(resp)
  3077. }
  3078. func ExampleEC2_EnableVolumeIO() {
  3079. svc := ec2.New(nil)
  3080. params := &ec2.EnableVolumeIOInput{
  3081. VolumeId: aws.String("String"), // Required
  3082. DryRun: aws.Bool(true),
  3083. }
  3084. resp, err := svc.EnableVolumeIO(params)
  3085. if err != nil {
  3086. // Print the error, cast err to awserr.Error to get the Code and
  3087. // Message from an error.
  3088. fmt.Println(err.Error())
  3089. return
  3090. }
  3091. // Pretty-print the response data.
  3092. fmt.Println(resp)
  3093. }
  3094. func ExampleEC2_EnableVpcClassicLink() {
  3095. svc := ec2.New(nil)
  3096. params := &ec2.EnableVpcClassicLinkInput{
  3097. VpcId: aws.String("String"), // Required
  3098. DryRun: aws.Bool(true),
  3099. }
  3100. resp, err := svc.EnableVpcClassicLink(params)
  3101. if err != nil {
  3102. // Print the error, cast err to awserr.Error to get the Code and
  3103. // Message from an error.
  3104. fmt.Println(err.Error())
  3105. return
  3106. }
  3107. // Pretty-print the response data.
  3108. fmt.Println(resp)
  3109. }
  3110. func ExampleEC2_GetConsoleOutput() {
  3111. svc := ec2.New(nil)
  3112. params := &ec2.GetConsoleOutputInput{
  3113. InstanceId: aws.String("String"), // Required
  3114. DryRun: aws.Bool(true),
  3115. }
  3116. resp, err := svc.GetConsoleOutput(params)
  3117. if err != nil {
  3118. // Print the error, cast err to awserr.Error to get the Code and
  3119. // Message from an error.
  3120. fmt.Println(err.Error())
  3121. return
  3122. }
  3123. // Pretty-print the response data.
  3124. fmt.Println(resp)
  3125. }
  3126. func ExampleEC2_GetPasswordData() {
  3127. svc := ec2.New(nil)
  3128. params := &ec2.GetPasswordDataInput{
  3129. InstanceId: aws.String("String"), // Required
  3130. DryRun: aws.Bool(true),
  3131. }
  3132. resp, err := svc.GetPasswordData(params)
  3133. if err != nil {
  3134. // Print the error, cast err to awserr.Error to get the Code and
  3135. // Message from an error.
  3136. fmt.Println(err.Error())
  3137. return
  3138. }
  3139. // Pretty-print the response data.
  3140. fmt.Println(resp)
  3141. }
  3142. func ExampleEC2_ImportImage() {
  3143. svc := ec2.New(nil)
  3144. params := &ec2.ImportImageInput{
  3145. Architecture: aws.String("String"),
  3146. ClientData: &ec2.ClientData{
  3147. Comment: aws.String("String"),
  3148. UploadEnd: aws.Time(time.Now()),
  3149. UploadSize: aws.Float64(1.0),
  3150. UploadStart: aws.Time(time.Now()),
  3151. },
  3152. ClientToken: aws.String("String"),
  3153. Description: aws.String("String"),
  3154. DiskContainers: []*ec2.ImageDiskContainer{
  3155. { // Required
  3156. Description: aws.String("String"),
  3157. DeviceName: aws.String("String"),
  3158. Format: aws.String("String"),
  3159. SnapshotId: aws.String("String"),
  3160. Url: aws.String("String"),
  3161. UserBucket: &ec2.UserBucket{
  3162. S3Bucket: aws.String("String"),
  3163. S3Key: aws.String("String"),
  3164. },
  3165. },
  3166. // More values...
  3167. },
  3168. DryRun: aws.Bool(true),
  3169. Hypervisor: aws.String("String"),
  3170. LicenseType: aws.String("String"),
  3171. Platform: aws.String("String"),
  3172. RoleName: aws.String("String"),
  3173. }
  3174. resp, err := svc.ImportImage(params)
  3175. if err != nil {
  3176. // Print the error, cast err to awserr.Error to get the Code and
  3177. // Message from an error.
  3178. fmt.Println(err.Error())
  3179. return
  3180. }
  3181. // Pretty-print the response data.
  3182. fmt.Println(resp)
  3183. }
  3184. func ExampleEC2_ImportInstance() {
  3185. svc := ec2.New(nil)
  3186. params := &ec2.ImportInstanceInput{
  3187. Platform: aws.String("PlatformValues"), // Required
  3188. Description: aws.String("String"),
  3189. DiskImages: []*ec2.DiskImage{
  3190. { // Required
  3191. Description: aws.String("String"),
  3192. Image: &ec2.DiskImageDetail{
  3193. Bytes: aws.Int64(1), // Required
  3194. Format: aws.String("DiskImageFormat"), // Required
  3195. ImportManifestUrl: aws.String("String"), // Required
  3196. },
  3197. Volume: &ec2.VolumeDetail{
  3198. Size: aws.Int64(1), // Required
  3199. },
  3200. },
  3201. // More values...
  3202. },
  3203. DryRun: aws.Bool(true),
  3204. LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{
  3205. AdditionalInfo: aws.String("String"),
  3206. Architecture: aws.String("ArchitectureValues"),
  3207. GroupIds: []*string{
  3208. aws.String("String"), // Required
  3209. // More values...
  3210. },
  3211. GroupNames: []*string{
  3212. aws.String("String"), // Required
  3213. // More values...
  3214. },
  3215. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  3216. InstanceType: aws.String("InstanceType"),
  3217. Monitoring: aws.Bool(true),
  3218. Placement: &ec2.Placement{
  3219. AvailabilityZone: aws.String("String"),
  3220. GroupName: aws.String("String"),
  3221. Tenancy: aws.String("Tenancy"),
  3222. },
  3223. PrivateIpAddress: aws.String("String"),
  3224. SubnetId: aws.String("String"),
  3225. UserData: &ec2.UserData{
  3226. Data: aws.String("String"),
  3227. },
  3228. },
  3229. }
  3230. resp, err := svc.ImportInstance(params)
  3231. if err != nil {
  3232. // Print the error, cast err to awserr.Error to get the Code and
  3233. // Message from an error.
  3234. fmt.Println(err.Error())
  3235. return
  3236. }
  3237. // Pretty-print the response data.
  3238. fmt.Println(resp)
  3239. }
  3240. func ExampleEC2_ImportKeyPair() {
  3241. svc := ec2.New(nil)
  3242. params := &ec2.ImportKeyPairInput{
  3243. KeyName: aws.String("String"), // Required
  3244. PublicKeyMaterial: []byte("PAYLOAD"), // Required
  3245. DryRun: aws.Bool(true),
  3246. }
  3247. resp, err := svc.ImportKeyPair(params)
  3248. if err != nil {
  3249. // Print the error, cast err to awserr.Error to get the Code and
  3250. // Message from an error.
  3251. fmt.Println(err.Error())
  3252. return
  3253. }
  3254. // Pretty-print the response data.
  3255. fmt.Println(resp)
  3256. }
  3257. func ExampleEC2_ImportSnapshot() {
  3258. svc := ec2.New(nil)
  3259. params := &ec2.ImportSnapshotInput{
  3260. ClientData: &ec2.ClientData{
  3261. Comment: aws.String("String"),
  3262. UploadEnd: aws.Time(time.Now()),
  3263. UploadSize: aws.Float64(1.0),
  3264. UploadStart: aws.Time(time.Now()),
  3265. },
  3266. ClientToken: aws.String("String"),
  3267. Description: aws.String("String"),
  3268. DiskContainer: &ec2.SnapshotDiskContainer{
  3269. Description: aws.String("String"),
  3270. Format: aws.String("String"),
  3271. Url: aws.String("String"),
  3272. UserBucket: &ec2.UserBucket{
  3273. S3Bucket: aws.String("String"),
  3274. S3Key: aws.String("String"),
  3275. },
  3276. },
  3277. DryRun: aws.Bool(true),
  3278. RoleName: aws.String("String"),
  3279. }
  3280. resp, err := svc.ImportSnapshot(params)
  3281. if err != nil {
  3282. // Print the error, cast err to awserr.Error to get the Code and
  3283. // Message from an error.
  3284. fmt.Println(err.Error())
  3285. return
  3286. }
  3287. // Pretty-print the response data.
  3288. fmt.Println(resp)
  3289. }
  3290. func ExampleEC2_ImportVolume() {
  3291. svc := ec2.New(nil)
  3292. params := &ec2.ImportVolumeInput{
  3293. AvailabilityZone: aws.String("String"), // Required
  3294. Image: &ec2.DiskImageDetail{ // Required
  3295. Bytes: aws.Int64(1), // Required
  3296. Format: aws.String("DiskImageFormat"), // Required
  3297. ImportManifestUrl: aws.String("String"), // Required
  3298. },
  3299. Volume: &ec2.VolumeDetail{ // Required
  3300. Size: aws.Int64(1), // Required
  3301. },
  3302. Description: aws.String("String"),
  3303. DryRun: aws.Bool(true),
  3304. }
  3305. resp, err := svc.ImportVolume(params)
  3306. if err != nil {
  3307. // Print the error, cast err to awserr.Error to get the Code and
  3308. // Message from an error.
  3309. fmt.Println(err.Error())
  3310. return
  3311. }
  3312. // Pretty-print the response data.
  3313. fmt.Println(resp)
  3314. }
  3315. func ExampleEC2_ModifyImageAttribute() {
  3316. svc := ec2.New(nil)
  3317. params := &ec2.ModifyImageAttributeInput{
  3318. ImageId: aws.String("String"), // Required
  3319. Attribute: aws.String("String"),
  3320. Description: &ec2.AttributeValue{
  3321. Value: aws.String("String"),
  3322. },
  3323. DryRun: aws.Bool(true),
  3324. LaunchPermission: &ec2.LaunchPermissionModifications{
  3325. Add: []*ec2.LaunchPermission{
  3326. { // Required
  3327. Group: aws.String("PermissionGroup"),
  3328. UserId: aws.String("String"),
  3329. },
  3330. // More values...
  3331. },
  3332. Remove: []*ec2.LaunchPermission{
  3333. { // Required
  3334. Group: aws.String("PermissionGroup"),
  3335. UserId: aws.String("String"),
  3336. },
  3337. // More values...
  3338. },
  3339. },
  3340. OperationType: aws.String("OperationType"),
  3341. ProductCodes: []*string{
  3342. aws.String("String"), // Required
  3343. // More values...
  3344. },
  3345. UserGroups: []*string{
  3346. aws.String("String"), // Required
  3347. // More values...
  3348. },
  3349. UserIds: []*string{
  3350. aws.String("String"), // Required
  3351. // More values...
  3352. },
  3353. Value: aws.String("String"),
  3354. }
  3355. resp, err := svc.ModifyImageAttribute(params)
  3356. if err != nil {
  3357. // Print the error, cast err to awserr.Error to get the Code and
  3358. // Message from an error.
  3359. fmt.Println(err.Error())
  3360. return
  3361. }
  3362. // Pretty-print the response data.
  3363. fmt.Println(resp)
  3364. }
  3365. func ExampleEC2_ModifyInstanceAttribute() {
  3366. svc := ec2.New(nil)
  3367. params := &ec2.ModifyInstanceAttributeInput{
  3368. InstanceId: aws.String("String"), // Required
  3369. Attribute: aws.String("InstanceAttributeName"),
  3370. BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{
  3371. { // Required
  3372. DeviceName: aws.String("String"),
  3373. Ebs: &ec2.EbsInstanceBlockDeviceSpecification{
  3374. DeleteOnTermination: aws.Bool(true),
  3375. VolumeId: aws.String("String"),
  3376. },
  3377. NoDevice: aws.String("String"),
  3378. VirtualName: aws.String("String"),
  3379. },
  3380. // More values...
  3381. },
  3382. DisableApiTermination: &ec2.AttributeBooleanValue{
  3383. Value: aws.Bool(true),
  3384. },
  3385. DryRun: aws.Bool(true),
  3386. EbsOptimized: &ec2.AttributeBooleanValue{
  3387. Value: aws.Bool(true),
  3388. },
  3389. Groups: []*string{
  3390. aws.String("String"), // Required
  3391. // More values...
  3392. },
  3393. InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{
  3394. Value: aws.String("String"),
  3395. },
  3396. InstanceType: &ec2.AttributeValue{
  3397. Value: aws.String("String"),
  3398. },
  3399. Kernel: &ec2.AttributeValue{
  3400. Value: aws.String("String"),
  3401. },
  3402. Ramdisk: &ec2.AttributeValue{
  3403. Value: aws.String("String"),
  3404. },
  3405. SourceDestCheck: &ec2.AttributeBooleanValue{
  3406. Value: aws.Bool(true),
  3407. },
  3408. SriovNetSupport: &ec2.AttributeValue{
  3409. Value: aws.String("String"),
  3410. },
  3411. UserData: &ec2.BlobAttributeValue{
  3412. Value: []byte("PAYLOAD"),
  3413. },
  3414. Value: aws.String("String"),
  3415. }
  3416. resp, err := svc.ModifyInstanceAttribute(params)
  3417. if err != nil {
  3418. // Print the error, cast err to awserr.Error to get the Code and
  3419. // Message from an error.
  3420. fmt.Println(err.Error())
  3421. return
  3422. }
  3423. // Pretty-print the response data.
  3424. fmt.Println(resp)
  3425. }
  3426. func ExampleEC2_ModifyNetworkInterfaceAttribute() {
  3427. svc := ec2.New(nil)
  3428. params := &ec2.ModifyNetworkInterfaceAttributeInput{
  3429. NetworkInterfaceId: aws.String("String"), // Required
  3430. Attachment: &ec2.NetworkInterfaceAttachmentChanges{
  3431. AttachmentId: aws.String("String"),
  3432. DeleteOnTermination: aws.Bool(true),
  3433. },
  3434. Description: &ec2.AttributeValue{
  3435. Value: aws.String("String"),
  3436. },
  3437. DryRun: aws.Bool(true),
  3438. Groups: []*string{
  3439. aws.String("String"), // Required
  3440. // More values...
  3441. },
  3442. SourceDestCheck: &ec2.AttributeBooleanValue{
  3443. Value: aws.Bool(true),
  3444. },
  3445. }
  3446. resp, err := svc.ModifyNetworkInterfaceAttribute(params)
  3447. if err != nil {
  3448. // Print the error, cast err to awserr.Error to get the Code and
  3449. // Message from an error.
  3450. fmt.Println(err.Error())
  3451. return
  3452. }
  3453. // Pretty-print the response data.
  3454. fmt.Println(resp)
  3455. }
  3456. func ExampleEC2_ModifyReservedInstances() {
  3457. svc := ec2.New(nil)
  3458. params := &ec2.ModifyReservedInstancesInput{
  3459. ReservedInstancesIds: []*string{ // Required
  3460. aws.String("String"), // Required
  3461. // More values...
  3462. },
  3463. TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required
  3464. { // Required
  3465. AvailabilityZone: aws.String("String"),
  3466. InstanceCount: aws.Int64(1),
  3467. InstanceType: aws.String("InstanceType"),
  3468. Platform: aws.String("String"),
  3469. },
  3470. // More values...
  3471. },
  3472. ClientToken: aws.String("String"),
  3473. }
  3474. resp, err := svc.ModifyReservedInstances(params)
  3475. if err != nil {
  3476. // Print the error, cast err to awserr.Error to get the Code and
  3477. // Message from an error.
  3478. fmt.Println(err.Error())
  3479. return
  3480. }
  3481. // Pretty-print the response data.
  3482. fmt.Println(resp)
  3483. }
  3484. func ExampleEC2_ModifySnapshotAttribute() {
  3485. svc := ec2.New(nil)
  3486. params := &ec2.ModifySnapshotAttributeInput{
  3487. SnapshotId: aws.String("String"), // Required
  3488. Attribute: aws.String("SnapshotAttributeName"),
  3489. CreateVolumePermission: &ec2.CreateVolumePermissionModifications{
  3490. Add: []*ec2.CreateVolumePermission{
  3491. { // Required
  3492. Group: aws.String("PermissionGroup"),
  3493. UserId: aws.String("String"),
  3494. },
  3495. // More values...
  3496. },
  3497. Remove: []*ec2.CreateVolumePermission{
  3498. { // Required
  3499. Group: aws.String("PermissionGroup"),
  3500. UserId: aws.String("String"),
  3501. },
  3502. // More values...
  3503. },
  3504. },
  3505. DryRun: aws.Bool(true),
  3506. GroupNames: []*string{
  3507. aws.String("String"), // Required
  3508. // More values...
  3509. },
  3510. OperationType: aws.String("OperationType"),
  3511. UserIds: []*string{
  3512. aws.String("String"), // Required
  3513. // More values...
  3514. },
  3515. }
  3516. resp, err := svc.ModifySnapshotAttribute(params)
  3517. if err != nil {
  3518. // Print the error, cast err to awserr.Error to get the Code and
  3519. // Message from an error.
  3520. fmt.Println(err.Error())
  3521. return
  3522. }
  3523. // Pretty-print the response data.
  3524. fmt.Println(resp)
  3525. }
  3526. func ExampleEC2_ModifySubnetAttribute() {
  3527. svc := ec2.New(nil)
  3528. params := &ec2.ModifySubnetAttributeInput{
  3529. SubnetId: aws.String("String"), // Required
  3530. MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{
  3531. Value: aws.Bool(true),
  3532. },
  3533. }
  3534. resp, err := svc.ModifySubnetAttribute(params)
  3535. if err != nil {
  3536. // Print the error, cast err to awserr.Error to get the Code and
  3537. // Message from an error.
  3538. fmt.Println(err.Error())
  3539. return
  3540. }
  3541. // Pretty-print the response data.
  3542. fmt.Println(resp)
  3543. }
  3544. func ExampleEC2_ModifyVolumeAttribute() {
  3545. svc := ec2.New(nil)
  3546. params := &ec2.ModifyVolumeAttributeInput{
  3547. VolumeId: aws.String("String"), // Required
  3548. AutoEnableIO: &ec2.AttributeBooleanValue{
  3549. Value: aws.Bool(true),
  3550. },
  3551. DryRun: aws.Bool(true),
  3552. }
  3553. resp, err := svc.ModifyVolumeAttribute(params)
  3554. if err != nil {
  3555. // Print the error, cast err to awserr.Error to get the Code and
  3556. // Message from an error.
  3557. fmt.Println(err.Error())
  3558. return
  3559. }
  3560. // Pretty-print the response data.
  3561. fmt.Println(resp)
  3562. }
  3563. func ExampleEC2_ModifyVpcAttribute() {
  3564. svc := ec2.New(nil)
  3565. params := &ec2.ModifyVpcAttributeInput{
  3566. VpcId: aws.String("String"), // Required
  3567. EnableDnsHostnames: &ec2.AttributeBooleanValue{
  3568. Value: aws.Bool(true),
  3569. },
  3570. EnableDnsSupport: &ec2.AttributeBooleanValue{
  3571. Value: aws.Bool(true),
  3572. },
  3573. }
  3574. resp, err := svc.ModifyVpcAttribute(params)
  3575. if err != nil {
  3576. // Print the error, cast err to awserr.Error to get the Code and
  3577. // Message from an error.
  3578. fmt.Println(err.Error())
  3579. return
  3580. }
  3581. // Pretty-print the response data.
  3582. fmt.Println(resp)
  3583. }
  3584. func ExampleEC2_ModifyVpcEndpoint() {
  3585. svc := ec2.New(nil)
  3586. params := &ec2.ModifyVpcEndpointInput{
  3587. VpcEndpointId: aws.String("String"), // Required
  3588. AddRouteTableIds: []*string{
  3589. aws.String("String"), // Required
  3590. // More values...
  3591. },
  3592. DryRun: aws.Bool(true),
  3593. PolicyDocument: aws.String("String"),
  3594. RemoveRouteTableIds: []*string{
  3595. aws.String("String"), // Required
  3596. // More values...
  3597. },
  3598. ResetPolicy: aws.Bool(true),
  3599. }
  3600. resp, err := svc.ModifyVpcEndpoint(params)
  3601. if err != nil {
  3602. // Print the error, cast err to awserr.Error to get the Code and
  3603. // Message from an error.
  3604. fmt.Println(err.Error())
  3605. return
  3606. }
  3607. // Pretty-print the response data.
  3608. fmt.Println(resp)
  3609. }
  3610. func ExampleEC2_MonitorInstances() {
  3611. svc := ec2.New(nil)
  3612. params := &ec2.MonitorInstancesInput{
  3613. InstanceIds: []*string{ // Required
  3614. aws.String("String"), // Required
  3615. // More values...
  3616. },
  3617. DryRun: aws.Bool(true),
  3618. }
  3619. resp, err := svc.MonitorInstances(params)
  3620. if err != nil {
  3621. // Print the error, cast err to awserr.Error to get the Code and
  3622. // Message from an error.
  3623. fmt.Println(err.Error())
  3624. return
  3625. }
  3626. // Pretty-print the response data.
  3627. fmt.Println(resp)
  3628. }
  3629. func ExampleEC2_MoveAddressToVpc() {
  3630. svc := ec2.New(nil)
  3631. params := &ec2.MoveAddressToVpcInput{
  3632. PublicIp: aws.String("String"), // Required
  3633. DryRun: aws.Bool(true),
  3634. }
  3635. resp, err := svc.MoveAddressToVpc(params)
  3636. if err != nil {
  3637. // Print the error, cast err to awserr.Error to get the Code and
  3638. // Message from an error.
  3639. fmt.Println(err.Error())
  3640. return
  3641. }
  3642. // Pretty-print the response data.
  3643. fmt.Println(resp)
  3644. }
  3645. func ExampleEC2_PurchaseReservedInstancesOffering() {
  3646. svc := ec2.New(nil)
  3647. params := &ec2.PurchaseReservedInstancesOfferingInput{
  3648. InstanceCount: aws.Int64(1), // Required
  3649. ReservedInstancesOfferingId: aws.String("String"), // Required
  3650. DryRun: aws.Bool(true),
  3651. LimitPrice: &ec2.ReservedInstanceLimitPrice{
  3652. Amount: aws.Float64(1.0),
  3653. CurrencyCode: aws.String("CurrencyCodeValues"),
  3654. },
  3655. }
  3656. resp, err := svc.PurchaseReservedInstancesOffering(params)
  3657. if err != nil {
  3658. // Print the error, cast err to awserr.Error to get the Code and
  3659. // Message from an error.
  3660. fmt.Println(err.Error())
  3661. return
  3662. }
  3663. // Pretty-print the response data.
  3664. fmt.Println(resp)
  3665. }
  3666. func ExampleEC2_RebootInstances() {
  3667. svc := ec2.New(nil)
  3668. params := &ec2.RebootInstancesInput{
  3669. InstanceIds: []*string{ // Required
  3670. aws.String("String"), // Required
  3671. // More values...
  3672. },
  3673. DryRun: aws.Bool(true),
  3674. }
  3675. resp, err := svc.RebootInstances(params)
  3676. if err != nil {
  3677. // Print the error, cast err to awserr.Error to get the Code and
  3678. // Message from an error.
  3679. fmt.Println(err.Error())
  3680. return
  3681. }
  3682. // Pretty-print the response data.
  3683. fmt.Println(resp)
  3684. }
  3685. func ExampleEC2_RegisterImage() {
  3686. svc := ec2.New(nil)
  3687. params := &ec2.RegisterImageInput{
  3688. Name: aws.String("String"), // Required
  3689. Architecture: aws.String("ArchitectureValues"),
  3690. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  3691. { // Required
  3692. DeviceName: aws.String("String"),
  3693. Ebs: &ec2.EbsBlockDevice{
  3694. DeleteOnTermination: aws.Bool(true),
  3695. Encrypted: aws.Bool(true),
  3696. Iops: aws.Int64(1),
  3697. SnapshotId: aws.String("String"),
  3698. VolumeSize: aws.Int64(1),
  3699. VolumeType: aws.String("VolumeType"),
  3700. },
  3701. NoDevice: aws.String("String"),
  3702. VirtualName: aws.String("String"),
  3703. },
  3704. // More values...
  3705. },
  3706. Description: aws.String("String"),
  3707. DryRun: aws.Bool(true),
  3708. ImageLocation: aws.String("String"),
  3709. KernelId: aws.String("String"),
  3710. RamdiskId: aws.String("String"),
  3711. RootDeviceName: aws.String("String"),
  3712. SriovNetSupport: aws.String("String"),
  3713. VirtualizationType: aws.String("String"),
  3714. }
  3715. resp, err := svc.RegisterImage(params)
  3716. if err != nil {
  3717. // Print the error, cast err to awserr.Error to get the Code and
  3718. // Message from an error.
  3719. fmt.Println(err.Error())
  3720. return
  3721. }
  3722. // Pretty-print the response data.
  3723. fmt.Println(resp)
  3724. }
  3725. func ExampleEC2_RejectVpcPeeringConnection() {
  3726. svc := ec2.New(nil)
  3727. params := &ec2.RejectVpcPeeringConnectionInput{
  3728. VpcPeeringConnectionId: aws.String("String"), // Required
  3729. DryRun: aws.Bool(true),
  3730. }
  3731. resp, err := svc.RejectVpcPeeringConnection(params)
  3732. if err != nil {
  3733. // Print the error, cast err to awserr.Error to get the Code and
  3734. // Message from an error.
  3735. fmt.Println(err.Error())
  3736. return
  3737. }
  3738. // Pretty-print the response data.
  3739. fmt.Println(resp)
  3740. }
  3741. func ExampleEC2_ReleaseAddress() {
  3742. svc := ec2.New(nil)
  3743. params := &ec2.ReleaseAddressInput{
  3744. AllocationId: aws.String("String"),
  3745. DryRun: aws.Bool(true),
  3746. PublicIp: aws.String("String"),
  3747. }
  3748. resp, err := svc.ReleaseAddress(params)
  3749. if err != nil {
  3750. // Print the error, cast err to awserr.Error to get the Code and
  3751. // Message from an error.
  3752. fmt.Println(err.Error())
  3753. return
  3754. }
  3755. // Pretty-print the response data.
  3756. fmt.Println(resp)
  3757. }
  3758. func ExampleEC2_ReplaceNetworkAclAssociation() {
  3759. svc := ec2.New(nil)
  3760. params := &ec2.ReplaceNetworkAclAssociationInput{
  3761. AssociationId: aws.String("String"), // Required
  3762. NetworkAclId: aws.String("String"), // Required
  3763. DryRun: aws.Bool(true),
  3764. }
  3765. resp, err := svc.ReplaceNetworkAclAssociation(params)
  3766. if err != nil {
  3767. // Print the error, cast err to awserr.Error to get the Code and
  3768. // Message from an error.
  3769. fmt.Println(err.Error())
  3770. return
  3771. }
  3772. // Pretty-print the response data.
  3773. fmt.Println(resp)
  3774. }
  3775. func ExampleEC2_ReplaceNetworkAclEntry() {
  3776. svc := ec2.New(nil)
  3777. params := &ec2.ReplaceNetworkAclEntryInput{
  3778. CidrBlock: aws.String("String"), // Required
  3779. Egress: aws.Bool(true), // Required
  3780. NetworkAclId: aws.String("String"), // Required
  3781. Protocol: aws.String("String"), // Required
  3782. RuleAction: aws.String("RuleAction"), // Required
  3783. RuleNumber: aws.Int64(1), // Required
  3784. DryRun: aws.Bool(true),
  3785. IcmpTypeCode: &ec2.IcmpTypeCode{
  3786. Code: aws.Int64(1),
  3787. Type: aws.Int64(1),
  3788. },
  3789. PortRange: &ec2.PortRange{
  3790. From: aws.Int64(1),
  3791. To: aws.Int64(1),
  3792. },
  3793. }
  3794. resp, err := svc.ReplaceNetworkAclEntry(params)
  3795. if err != nil {
  3796. // Print the error, cast err to awserr.Error to get the Code and
  3797. // Message from an error.
  3798. fmt.Println(err.Error())
  3799. return
  3800. }
  3801. // Pretty-print the response data.
  3802. fmt.Println(resp)
  3803. }
  3804. func ExampleEC2_ReplaceRoute() {
  3805. svc := ec2.New(nil)
  3806. params := &ec2.ReplaceRouteInput{
  3807. DestinationCidrBlock: aws.String("String"), // Required
  3808. RouteTableId: aws.String("String"), // Required
  3809. DryRun: aws.Bool(true),
  3810. GatewayId: aws.String("String"),
  3811. InstanceId: aws.String("String"),
  3812. NetworkInterfaceId: aws.String("String"),
  3813. VpcPeeringConnectionId: aws.String("String"),
  3814. }
  3815. resp, err := svc.ReplaceRoute(params)
  3816. if err != nil {
  3817. // Print the error, cast err to awserr.Error to get the Code and
  3818. // Message from an error.
  3819. fmt.Println(err.Error())
  3820. return
  3821. }
  3822. // Pretty-print the response data.
  3823. fmt.Println(resp)
  3824. }
  3825. func ExampleEC2_ReplaceRouteTableAssociation() {
  3826. svc := ec2.New(nil)
  3827. params := &ec2.ReplaceRouteTableAssociationInput{
  3828. AssociationId: aws.String("String"), // Required
  3829. RouteTableId: aws.String("String"), // Required
  3830. DryRun: aws.Bool(true),
  3831. }
  3832. resp, err := svc.ReplaceRouteTableAssociation(params)
  3833. if err != nil {
  3834. // Print the error, cast err to awserr.Error to get the Code and
  3835. // Message from an error.
  3836. fmt.Println(err.Error())
  3837. return
  3838. }
  3839. // Pretty-print the response data.
  3840. fmt.Println(resp)
  3841. }
  3842. func ExampleEC2_ReportInstanceStatus() {
  3843. svc := ec2.New(nil)
  3844. params := &ec2.ReportInstanceStatusInput{
  3845. Instances: []*string{ // Required
  3846. aws.String("String"), // Required
  3847. // More values...
  3848. },
  3849. ReasonCodes: []*string{ // Required
  3850. aws.String("ReportInstanceReasonCodes"), // Required
  3851. // More values...
  3852. },
  3853. Status: aws.String("ReportStatusType"), // Required
  3854. Description: aws.String("String"),
  3855. DryRun: aws.Bool(true),
  3856. EndTime: aws.Time(time.Now()),
  3857. StartTime: aws.Time(time.Now()),
  3858. }
  3859. resp, err := svc.ReportInstanceStatus(params)
  3860. if err != nil {
  3861. // Print the error, cast err to awserr.Error to get the Code and
  3862. // Message from an error.
  3863. fmt.Println(err.Error())
  3864. return
  3865. }
  3866. // Pretty-print the response data.
  3867. fmt.Println(resp)
  3868. }
  3869. func ExampleEC2_RequestSpotFleet() {
  3870. svc := ec2.New(nil)
  3871. params := &ec2.RequestSpotFleetInput{
  3872. SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required
  3873. IamFleetRole: aws.String("String"), // Required
  3874. LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required
  3875. { // Required
  3876. AddressingType: aws.String("String"),
  3877. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  3878. { // Required
  3879. DeviceName: aws.String("String"),
  3880. Ebs: &ec2.EbsBlockDevice{
  3881. DeleteOnTermination: aws.Bool(true),
  3882. Encrypted: aws.Bool(true),
  3883. Iops: aws.Int64(1),
  3884. SnapshotId: aws.String("String"),
  3885. VolumeSize: aws.Int64(1),
  3886. VolumeType: aws.String("VolumeType"),
  3887. },
  3888. NoDevice: aws.String("String"),
  3889. VirtualName: aws.String("String"),
  3890. },
  3891. // More values...
  3892. },
  3893. EbsOptimized: aws.Bool(true),
  3894. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  3895. Arn: aws.String("String"),
  3896. Name: aws.String("String"),
  3897. },
  3898. ImageId: aws.String("String"),
  3899. InstanceType: aws.String("InstanceType"),
  3900. KernelId: aws.String("String"),
  3901. KeyName: aws.String("String"),
  3902. Monitoring: &ec2.SpotFleetMonitoring{
  3903. Enabled: aws.Bool(true),
  3904. },
  3905. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  3906. { // Required
  3907. AssociatePublicIpAddress: aws.Bool(true),
  3908. DeleteOnTermination: aws.Bool(true),
  3909. Description: aws.String("String"),
  3910. DeviceIndex: aws.Int64(1),
  3911. Groups: []*string{
  3912. aws.String("String"), // Required
  3913. // More values...
  3914. },
  3915. NetworkInterfaceId: aws.String("String"),
  3916. PrivateIpAddress: aws.String("String"),
  3917. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  3918. { // Required
  3919. PrivateIpAddress: aws.String("String"), // Required
  3920. Primary: aws.Bool(true),
  3921. },
  3922. // More values...
  3923. },
  3924. SecondaryPrivateIpAddressCount: aws.Int64(1),
  3925. SubnetId: aws.String("String"),
  3926. },
  3927. // More values...
  3928. },
  3929. Placement: &ec2.SpotPlacement{
  3930. AvailabilityZone: aws.String("String"),
  3931. GroupName: aws.String("String"),
  3932. },
  3933. RamdiskId: aws.String("String"),
  3934. SecurityGroups: []*ec2.GroupIdentifier{
  3935. { // Required
  3936. GroupId: aws.String("String"),
  3937. GroupName: aws.String("String"),
  3938. },
  3939. // More values...
  3940. },
  3941. SpotPrice: aws.String("String"),
  3942. SubnetId: aws.String("String"),
  3943. UserData: aws.String("String"),
  3944. WeightedCapacity: aws.Float64(1.0),
  3945. },
  3946. // More values...
  3947. },
  3948. SpotPrice: aws.String("String"), // Required
  3949. TargetCapacity: aws.Int64(1), // Required
  3950. ClientToken: aws.String("String"),
  3951. TerminateInstancesWithExpiration: aws.Bool(true),
  3952. ValidFrom: aws.Time(time.Now()),
  3953. ValidUntil: aws.Time(time.Now()),
  3954. },
  3955. DryRun: aws.Bool(true),
  3956. }
  3957. resp, err := svc.RequestSpotFleet(params)
  3958. if err != nil {
  3959. // Print the error, cast err to awserr.Error to get the Code and
  3960. // Message from an error.
  3961. fmt.Println(err.Error())
  3962. return
  3963. }
  3964. // Pretty-print the response data.
  3965. fmt.Println(resp)
  3966. }
  3967. func ExampleEC2_RequestSpotInstances() {
  3968. svc := ec2.New(nil)
  3969. params := &ec2.RequestSpotInstancesInput{
  3970. SpotPrice: aws.String("String"), // Required
  3971. AvailabilityZoneGroup: aws.String("String"),
  3972. ClientToken: aws.String("String"),
  3973. DryRun: aws.Bool(true),
  3974. InstanceCount: aws.Int64(1),
  3975. LaunchGroup: aws.String("String"),
  3976. LaunchSpecification: &ec2.RequestSpotLaunchSpecification{
  3977. AddressingType: aws.String("String"),
  3978. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  3979. { // Required
  3980. DeviceName: aws.String("String"),
  3981. Ebs: &ec2.EbsBlockDevice{
  3982. DeleteOnTermination: aws.Bool(true),
  3983. Encrypted: aws.Bool(true),
  3984. Iops: aws.Int64(1),
  3985. SnapshotId: aws.String("String"),
  3986. VolumeSize: aws.Int64(1),
  3987. VolumeType: aws.String("VolumeType"),
  3988. },
  3989. NoDevice: aws.String("String"),
  3990. VirtualName: aws.String("String"),
  3991. },
  3992. // More values...
  3993. },
  3994. EbsOptimized: aws.Bool(true),
  3995. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  3996. Arn: aws.String("String"),
  3997. Name: aws.String("String"),
  3998. },
  3999. ImageId: aws.String("String"),
  4000. InstanceType: aws.String("InstanceType"),
  4001. KernelId: aws.String("String"),
  4002. KeyName: aws.String("String"),
  4003. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  4004. Enabled: aws.Bool(true), // Required
  4005. },
  4006. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  4007. { // Required
  4008. AssociatePublicIpAddress: aws.Bool(true),
  4009. DeleteOnTermination: aws.Bool(true),
  4010. Description: aws.String("String"),
  4011. DeviceIndex: aws.Int64(1),
  4012. Groups: []*string{
  4013. aws.String("String"), // Required
  4014. // More values...
  4015. },
  4016. NetworkInterfaceId: aws.String("String"),
  4017. PrivateIpAddress: aws.String("String"),
  4018. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  4019. { // Required
  4020. PrivateIpAddress: aws.String("String"), // Required
  4021. Primary: aws.Bool(true),
  4022. },
  4023. // More values...
  4024. },
  4025. SecondaryPrivateIpAddressCount: aws.Int64(1),
  4026. SubnetId: aws.String("String"),
  4027. },
  4028. // More values...
  4029. },
  4030. Placement: &ec2.SpotPlacement{
  4031. AvailabilityZone: aws.String("String"),
  4032. GroupName: aws.String("String"),
  4033. },
  4034. RamdiskId: aws.String("String"),
  4035. SecurityGroupIds: []*string{
  4036. aws.String("String"), // Required
  4037. // More values...
  4038. },
  4039. SecurityGroups: []*string{
  4040. aws.String("String"), // Required
  4041. // More values...
  4042. },
  4043. SubnetId: aws.String("String"),
  4044. UserData: aws.String("String"),
  4045. },
  4046. Type: aws.String("SpotInstanceType"),
  4047. ValidFrom: aws.Time(time.Now()),
  4048. ValidUntil: aws.Time(time.Now()),
  4049. }
  4050. resp, err := svc.RequestSpotInstances(params)
  4051. if err != nil {
  4052. // Print the error, cast err to awserr.Error to get the Code and
  4053. // Message from an error.
  4054. fmt.Println(err.Error())
  4055. return
  4056. }
  4057. // Pretty-print the response data.
  4058. fmt.Println(resp)
  4059. }
  4060. func ExampleEC2_ResetImageAttribute() {
  4061. svc := ec2.New(nil)
  4062. params := &ec2.ResetImageAttributeInput{
  4063. Attribute: aws.String("ResetImageAttributeName"), // Required
  4064. ImageId: aws.String("String"), // Required
  4065. DryRun: aws.Bool(true),
  4066. }
  4067. resp, err := svc.ResetImageAttribute(params)
  4068. if err != nil {
  4069. // Print the error, cast err to awserr.Error to get the Code and
  4070. // Message from an error.
  4071. fmt.Println(err.Error())
  4072. return
  4073. }
  4074. // Pretty-print the response data.
  4075. fmt.Println(resp)
  4076. }
  4077. func ExampleEC2_ResetInstanceAttribute() {
  4078. svc := ec2.New(nil)
  4079. params := &ec2.ResetInstanceAttributeInput{
  4080. Attribute: aws.String("InstanceAttributeName"), // Required
  4081. InstanceId: aws.String("String"), // Required
  4082. DryRun: aws.Bool(true),
  4083. }
  4084. resp, err := svc.ResetInstanceAttribute(params)
  4085. if err != nil {
  4086. // Print the error, cast err to awserr.Error to get the Code and
  4087. // Message from an error.
  4088. fmt.Println(err.Error())
  4089. return
  4090. }
  4091. // Pretty-print the response data.
  4092. fmt.Println(resp)
  4093. }
  4094. func ExampleEC2_ResetNetworkInterfaceAttribute() {
  4095. svc := ec2.New(nil)
  4096. params := &ec2.ResetNetworkInterfaceAttributeInput{
  4097. NetworkInterfaceId: aws.String("String"), // Required
  4098. DryRun: aws.Bool(true),
  4099. SourceDestCheck: aws.String("String"),
  4100. }
  4101. resp, err := svc.ResetNetworkInterfaceAttribute(params)
  4102. if err != nil {
  4103. // Print the error, cast err to awserr.Error to get the Code and
  4104. // Message from an error.
  4105. fmt.Println(err.Error())
  4106. return
  4107. }
  4108. // Pretty-print the response data.
  4109. fmt.Println(resp)
  4110. }
  4111. func ExampleEC2_ResetSnapshotAttribute() {
  4112. svc := ec2.New(nil)
  4113. params := &ec2.ResetSnapshotAttributeInput{
  4114. Attribute: aws.String("SnapshotAttributeName"), // Required
  4115. SnapshotId: aws.String("String"), // Required
  4116. DryRun: aws.Bool(true),
  4117. }
  4118. resp, err := svc.ResetSnapshotAttribute(params)
  4119. if err != nil {
  4120. // Print the error, cast err to awserr.Error to get the Code and
  4121. // Message from an error.
  4122. fmt.Println(err.Error())
  4123. return
  4124. }
  4125. // Pretty-print the response data.
  4126. fmt.Println(resp)
  4127. }
  4128. func ExampleEC2_RestoreAddressToClassic() {
  4129. svc := ec2.New(nil)
  4130. params := &ec2.RestoreAddressToClassicInput{
  4131. PublicIp: aws.String("String"), // Required
  4132. DryRun: aws.Bool(true),
  4133. }
  4134. resp, err := svc.RestoreAddressToClassic(params)
  4135. if err != nil {
  4136. // Print the error, cast err to awserr.Error to get the Code and
  4137. // Message from an error.
  4138. fmt.Println(err.Error())
  4139. return
  4140. }
  4141. // Pretty-print the response data.
  4142. fmt.Println(resp)
  4143. }
  4144. func ExampleEC2_RevokeSecurityGroupEgress() {
  4145. svc := ec2.New(nil)
  4146. params := &ec2.RevokeSecurityGroupEgressInput{
  4147. GroupId: aws.String("String"), // Required
  4148. CidrIp: aws.String("String"),
  4149. DryRun: aws.Bool(true),
  4150. FromPort: aws.Int64(1),
  4151. IpPermissions: []*ec2.IpPermission{
  4152. { // Required
  4153. FromPort: aws.Int64(1),
  4154. IpProtocol: aws.String("String"),
  4155. IpRanges: []*ec2.IpRange{
  4156. { // Required
  4157. CidrIp: aws.String("String"),
  4158. },
  4159. // More values...
  4160. },
  4161. PrefixListIds: []*ec2.PrefixListId{
  4162. { // Required
  4163. PrefixListId: aws.String("String"),
  4164. },
  4165. // More values...
  4166. },
  4167. ToPort: aws.Int64(1),
  4168. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  4169. { // Required
  4170. GroupId: aws.String("String"),
  4171. GroupName: aws.String("String"),
  4172. UserId: aws.String("String"),
  4173. },
  4174. // More values...
  4175. },
  4176. },
  4177. // More values...
  4178. },
  4179. IpProtocol: aws.String("String"),
  4180. SourceSecurityGroupName: aws.String("String"),
  4181. SourceSecurityGroupOwnerId: aws.String("String"),
  4182. ToPort: aws.Int64(1),
  4183. }
  4184. resp, err := svc.RevokeSecurityGroupEgress(params)
  4185. if err != nil {
  4186. // Print the error, cast err to awserr.Error to get the Code and
  4187. // Message from an error.
  4188. fmt.Println(err.Error())
  4189. return
  4190. }
  4191. // Pretty-print the response data.
  4192. fmt.Println(resp)
  4193. }
  4194. func ExampleEC2_RevokeSecurityGroupIngress() {
  4195. svc := ec2.New(nil)
  4196. params := &ec2.RevokeSecurityGroupIngressInput{
  4197. CidrIp: aws.String("String"),
  4198. DryRun: aws.Bool(true),
  4199. FromPort: aws.Int64(1),
  4200. GroupId: aws.String("String"),
  4201. GroupName: aws.String("String"),
  4202. IpPermissions: []*ec2.IpPermission{
  4203. { // Required
  4204. FromPort: aws.Int64(1),
  4205. IpProtocol: aws.String("String"),
  4206. IpRanges: []*ec2.IpRange{
  4207. { // Required
  4208. CidrIp: aws.String("String"),
  4209. },
  4210. // More values...
  4211. },
  4212. PrefixListIds: []*ec2.PrefixListId{
  4213. { // Required
  4214. PrefixListId: aws.String("String"),
  4215. },
  4216. // More values...
  4217. },
  4218. ToPort: aws.Int64(1),
  4219. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  4220. { // Required
  4221. GroupId: aws.String("String"),
  4222. GroupName: aws.String("String"),
  4223. UserId: aws.String("String"),
  4224. },
  4225. // More values...
  4226. },
  4227. },
  4228. // More values...
  4229. },
  4230. IpProtocol: aws.String("String"),
  4231. SourceSecurityGroupName: aws.String("String"),
  4232. SourceSecurityGroupOwnerId: aws.String("String"),
  4233. ToPort: aws.Int64(1),
  4234. }
  4235. resp, err := svc.RevokeSecurityGroupIngress(params)
  4236. if err != nil {
  4237. // Print the error, cast err to awserr.Error to get the Code and
  4238. // Message from an error.
  4239. fmt.Println(err.Error())
  4240. return
  4241. }
  4242. // Pretty-print the response data.
  4243. fmt.Println(resp)
  4244. }
  4245. func ExampleEC2_RunInstances() {
  4246. svc := ec2.New(nil)
  4247. params := &ec2.RunInstancesInput{
  4248. ImageId: aws.String("String"), // Required
  4249. MaxCount: aws.Int64(1), // Required
  4250. MinCount: aws.Int64(1), // Required
  4251. AdditionalInfo: aws.String("String"),
  4252. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  4253. { // Required
  4254. DeviceName: aws.String("String"),
  4255. Ebs: &ec2.EbsBlockDevice{
  4256. DeleteOnTermination: aws.Bool(true),
  4257. Encrypted: aws.Bool(true),
  4258. Iops: aws.Int64(1),
  4259. SnapshotId: aws.String("String"),
  4260. VolumeSize: aws.Int64(1),
  4261. VolumeType: aws.String("VolumeType"),
  4262. },
  4263. NoDevice: aws.String("String"),
  4264. VirtualName: aws.String("String"),
  4265. },
  4266. // More values...
  4267. },
  4268. ClientToken: aws.String("String"),
  4269. DisableApiTermination: aws.Bool(true),
  4270. DryRun: aws.Bool(true),
  4271. EbsOptimized: aws.Bool(true),
  4272. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  4273. Arn: aws.String("String"),
  4274. Name: aws.String("String"),
  4275. },
  4276. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  4277. InstanceType: aws.String("InstanceType"),
  4278. KernelId: aws.String("String"),
  4279. KeyName: aws.String("String"),
  4280. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  4281. Enabled: aws.Bool(true), // Required
  4282. },
  4283. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  4284. { // Required
  4285. AssociatePublicIpAddress: aws.Bool(true),
  4286. DeleteOnTermination: aws.Bool(true),
  4287. Description: aws.String("String"),
  4288. DeviceIndex: aws.Int64(1),
  4289. Groups: []*string{
  4290. aws.String("String"), // Required
  4291. // More values...
  4292. },
  4293. NetworkInterfaceId: aws.String("String"),
  4294. PrivateIpAddress: aws.String("String"),
  4295. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  4296. { // Required
  4297. PrivateIpAddress: aws.String("String"), // Required
  4298. Primary: aws.Bool(true),
  4299. },
  4300. // More values...
  4301. },
  4302. SecondaryPrivateIpAddressCount: aws.Int64(1),
  4303. SubnetId: aws.String("String"),
  4304. },
  4305. // More values...
  4306. },
  4307. Placement: &ec2.Placement{
  4308. AvailabilityZone: aws.String("String"),
  4309. GroupName: aws.String("String"),
  4310. Tenancy: aws.String("Tenancy"),
  4311. },
  4312. PrivateIpAddress: aws.String("String"),
  4313. RamdiskId: aws.String("String"),
  4314. SecurityGroupIds: []*string{
  4315. aws.String("String"), // Required
  4316. // More values...
  4317. },
  4318. SecurityGroups: []*string{
  4319. aws.String("String"), // Required
  4320. // More values...
  4321. },
  4322. SubnetId: aws.String("String"),
  4323. UserData: aws.String("String"),
  4324. }
  4325. resp, err := svc.RunInstances(params)
  4326. if err != nil {
  4327. // Print the error, cast err to awserr.Error to get the Code and
  4328. // Message from an error.
  4329. fmt.Println(err.Error())
  4330. return
  4331. }
  4332. // Pretty-print the response data.
  4333. fmt.Println(resp)
  4334. }
  4335. func ExampleEC2_StartInstances() {
  4336. svc := ec2.New(nil)
  4337. params := &ec2.StartInstancesInput{
  4338. InstanceIds: []*string{ // Required
  4339. aws.String("String"), // Required
  4340. // More values...
  4341. },
  4342. AdditionalInfo: aws.String("String"),
  4343. DryRun: aws.Bool(true),
  4344. }
  4345. resp, err := svc.StartInstances(params)
  4346. if err != nil {
  4347. // Print the error, cast err to awserr.Error to get the Code and
  4348. // Message from an error.
  4349. fmt.Println(err.Error())
  4350. return
  4351. }
  4352. // Pretty-print the response data.
  4353. fmt.Println(resp)
  4354. }
  4355. func ExampleEC2_StopInstances() {
  4356. svc := ec2.New(nil)
  4357. params := &ec2.StopInstancesInput{
  4358. InstanceIds: []*string{ // Required
  4359. aws.String("String"), // Required
  4360. // More values...
  4361. },
  4362. DryRun: aws.Bool(true),
  4363. Force: aws.Bool(true),
  4364. }
  4365. resp, err := svc.StopInstances(params)
  4366. if err != nil {
  4367. // Print the error, cast err to awserr.Error to get the Code and
  4368. // Message from an error.
  4369. fmt.Println(err.Error())
  4370. return
  4371. }
  4372. // Pretty-print the response data.
  4373. fmt.Println(resp)
  4374. }
  4375. func ExampleEC2_TerminateInstances() {
  4376. svc := ec2.New(nil)
  4377. params := &ec2.TerminateInstancesInput{
  4378. InstanceIds: []*string{ // Required
  4379. aws.String("String"), // Required
  4380. // More values...
  4381. },
  4382. DryRun: aws.Bool(true),
  4383. }
  4384. resp, err := svc.TerminateInstances(params)
  4385. if err != nil {
  4386. // Print the error, cast err to awserr.Error to get the Code and
  4387. // Message from an error.
  4388. fmt.Println(err.Error())
  4389. return
  4390. }
  4391. // Pretty-print the response data.
  4392. fmt.Println(resp)
  4393. }
  4394. func ExampleEC2_UnassignPrivateIpAddresses() {
  4395. svc := ec2.New(nil)
  4396. params := &ec2.UnassignPrivateIpAddressesInput{
  4397. NetworkInterfaceId: aws.String("String"), // Required
  4398. PrivateIpAddresses: []*string{ // Required
  4399. aws.String("String"), // Required
  4400. // More values...
  4401. },
  4402. }
  4403. resp, err := svc.UnassignPrivateIpAddresses(params)
  4404. if err != nil {
  4405. // Print the error, cast err to awserr.Error to get the Code and
  4406. // Message from an error.
  4407. fmt.Println(err.Error())
  4408. return
  4409. }
  4410. // Pretty-print the response data.
  4411. fmt.Println(resp)
  4412. }
  4413. func ExampleEC2_UnmonitorInstances() {
  4414. svc := ec2.New(nil)
  4415. params := &ec2.UnmonitorInstancesInput{
  4416. InstanceIds: []*string{ // Required
  4417. aws.String("String"), // Required
  4418. // More values...
  4419. },
  4420. DryRun: aws.Bool(true),
  4421. }
  4422. resp, err := svc.UnmonitorInstances(params)
  4423. if err != nil {
  4424. // Print the error, cast err to awserr.Error to get the Code and
  4425. // Message from an error.
  4426. fmt.Println(err.Error())
  4427. return
  4428. }
  4429. // Pretty-print the response data.
  4430. fmt.Println(resp)
  4431. }