examples_test.go 165 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291
  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/aws/session"
  9. "github.com/aws/aws-sdk-go/service/ec2"
  10. )
  11. var _ time.Duration
  12. var _ bytes.Buffer
  13. func ExampleEC2_AcceptReservedInstancesExchangeQuote() {
  14. sess, err := session.NewSession()
  15. if err != nil {
  16. fmt.Println("failed to create session,", err)
  17. return
  18. }
  19. svc := ec2.New(sess)
  20. params := &ec2.AcceptReservedInstancesExchangeQuoteInput{
  21. ReservedInstanceIds: []*string{ // Required
  22. aws.String("String"), // Required
  23. // More values...
  24. },
  25. DryRun: aws.Bool(true),
  26. TargetConfigurations: []*ec2.TargetConfigurationRequest{
  27. { // Required
  28. OfferingId: aws.String("String"), // Required
  29. InstanceCount: aws.Int64(1),
  30. },
  31. // More values...
  32. },
  33. }
  34. resp, err := svc.AcceptReservedInstancesExchangeQuote(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_AcceptVpcPeeringConnection() {
  45. sess, err := session.NewSession()
  46. if err != nil {
  47. fmt.Println("failed to create session,", err)
  48. return
  49. }
  50. svc := ec2.New(sess)
  51. params := &ec2.AcceptVpcPeeringConnectionInput{
  52. DryRun: aws.Bool(true),
  53. VpcPeeringConnectionId: aws.String("String"),
  54. }
  55. resp, err := svc.AcceptVpcPeeringConnection(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_AllocateAddress() {
  66. sess, err := session.NewSession()
  67. if err != nil {
  68. fmt.Println("failed to create session,", err)
  69. return
  70. }
  71. svc := ec2.New(sess)
  72. params := &ec2.AllocateAddressInput{
  73. Domain: aws.String("DomainType"),
  74. DryRun: aws.Bool(true),
  75. }
  76. resp, err := svc.AllocateAddress(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_AllocateHosts() {
  87. sess, err := session.NewSession()
  88. if err != nil {
  89. fmt.Println("failed to create session,", err)
  90. return
  91. }
  92. svc := ec2.New(sess)
  93. params := &ec2.AllocateHostsInput{
  94. AvailabilityZone: aws.String("String"), // Required
  95. InstanceType: aws.String("String"), // Required
  96. Quantity: aws.Int64(1), // Required
  97. AutoPlacement: aws.String("AutoPlacement"),
  98. ClientToken: aws.String("String"),
  99. }
  100. resp, err := svc.AllocateHosts(params)
  101. if err != nil {
  102. // Print the error, cast err to awserr.Error to get the Code and
  103. // Message from an error.
  104. fmt.Println(err.Error())
  105. return
  106. }
  107. // Pretty-print the response data.
  108. fmt.Println(resp)
  109. }
  110. func ExampleEC2_AssignPrivateIpAddresses() {
  111. sess, err := session.NewSession()
  112. if err != nil {
  113. fmt.Println("failed to create session,", err)
  114. return
  115. }
  116. svc := ec2.New(sess)
  117. params := &ec2.AssignPrivateIpAddressesInput{
  118. NetworkInterfaceId: aws.String("String"), // Required
  119. AllowReassignment: aws.Bool(true),
  120. PrivateIpAddresses: []*string{
  121. aws.String("String"), // Required
  122. // More values...
  123. },
  124. SecondaryPrivateIpAddressCount: aws.Int64(1),
  125. }
  126. resp, err := svc.AssignPrivateIpAddresses(params)
  127. if err != nil {
  128. // Print the error, cast err to awserr.Error to get the Code and
  129. // Message from an error.
  130. fmt.Println(err.Error())
  131. return
  132. }
  133. // Pretty-print the response data.
  134. fmt.Println(resp)
  135. }
  136. func ExampleEC2_AssociateAddress() {
  137. sess, err := session.NewSession()
  138. if err != nil {
  139. fmt.Println("failed to create session,", err)
  140. return
  141. }
  142. svc := ec2.New(sess)
  143. params := &ec2.AssociateAddressInput{
  144. AllocationId: aws.String("String"),
  145. AllowReassociation: aws.Bool(true),
  146. DryRun: aws.Bool(true),
  147. InstanceId: aws.String("String"),
  148. NetworkInterfaceId: aws.String("String"),
  149. PrivateIpAddress: aws.String("String"),
  150. PublicIp: aws.String("String"),
  151. }
  152. resp, err := svc.AssociateAddress(params)
  153. if err != nil {
  154. // Print the error, cast err to awserr.Error to get the Code and
  155. // Message from an error.
  156. fmt.Println(err.Error())
  157. return
  158. }
  159. // Pretty-print the response data.
  160. fmt.Println(resp)
  161. }
  162. func ExampleEC2_AssociateDhcpOptions() {
  163. sess, err := session.NewSession()
  164. if err != nil {
  165. fmt.Println("failed to create session,", err)
  166. return
  167. }
  168. svc := ec2.New(sess)
  169. params := &ec2.AssociateDhcpOptionsInput{
  170. DhcpOptionsId: aws.String("String"), // Required
  171. VpcId: aws.String("String"), // Required
  172. DryRun: aws.Bool(true),
  173. }
  174. resp, err := svc.AssociateDhcpOptions(params)
  175. if err != nil {
  176. // Print the error, cast err to awserr.Error to get the Code and
  177. // Message from an error.
  178. fmt.Println(err.Error())
  179. return
  180. }
  181. // Pretty-print the response data.
  182. fmt.Println(resp)
  183. }
  184. func ExampleEC2_AssociateRouteTable() {
  185. sess, err := session.NewSession()
  186. if err != nil {
  187. fmt.Println("failed to create session,", err)
  188. return
  189. }
  190. svc := ec2.New(sess)
  191. params := &ec2.AssociateRouteTableInput{
  192. RouteTableId: aws.String("String"), // Required
  193. SubnetId: aws.String("String"), // Required
  194. DryRun: aws.Bool(true),
  195. }
  196. resp, err := svc.AssociateRouteTable(params)
  197. if err != nil {
  198. // Print the error, cast err to awserr.Error to get the Code and
  199. // Message from an error.
  200. fmt.Println(err.Error())
  201. return
  202. }
  203. // Pretty-print the response data.
  204. fmt.Println(resp)
  205. }
  206. func ExampleEC2_AttachClassicLinkVpc() {
  207. sess, err := session.NewSession()
  208. if err != nil {
  209. fmt.Println("failed to create session,", err)
  210. return
  211. }
  212. svc := ec2.New(sess)
  213. params := &ec2.AttachClassicLinkVpcInput{
  214. Groups: []*string{ // Required
  215. aws.String("String"), // Required
  216. // More values...
  217. },
  218. InstanceId: aws.String("String"), // Required
  219. VpcId: aws.String("String"), // Required
  220. DryRun: aws.Bool(true),
  221. }
  222. resp, err := svc.AttachClassicLinkVpc(params)
  223. if err != nil {
  224. // Print the error, cast err to awserr.Error to get the Code and
  225. // Message from an error.
  226. fmt.Println(err.Error())
  227. return
  228. }
  229. // Pretty-print the response data.
  230. fmt.Println(resp)
  231. }
  232. func ExampleEC2_AttachInternetGateway() {
  233. sess, err := session.NewSession()
  234. if err != nil {
  235. fmt.Println("failed to create session,", err)
  236. return
  237. }
  238. svc := ec2.New(sess)
  239. params := &ec2.AttachInternetGatewayInput{
  240. InternetGatewayId: aws.String("String"), // Required
  241. VpcId: aws.String("String"), // Required
  242. DryRun: aws.Bool(true),
  243. }
  244. resp, err := svc.AttachInternetGateway(params)
  245. if err != nil {
  246. // Print the error, cast err to awserr.Error to get the Code and
  247. // Message from an error.
  248. fmt.Println(err.Error())
  249. return
  250. }
  251. // Pretty-print the response data.
  252. fmt.Println(resp)
  253. }
  254. func ExampleEC2_AttachNetworkInterface() {
  255. sess, err := session.NewSession()
  256. if err != nil {
  257. fmt.Println("failed to create session,", err)
  258. return
  259. }
  260. svc := ec2.New(sess)
  261. params := &ec2.AttachNetworkInterfaceInput{
  262. DeviceIndex: aws.Int64(1), // Required
  263. InstanceId: aws.String("String"), // Required
  264. NetworkInterfaceId: aws.String("String"), // Required
  265. DryRun: aws.Bool(true),
  266. }
  267. resp, err := svc.AttachNetworkInterface(params)
  268. if err != nil {
  269. // Print the error, cast err to awserr.Error to get the Code and
  270. // Message from an error.
  271. fmt.Println(err.Error())
  272. return
  273. }
  274. // Pretty-print the response data.
  275. fmt.Println(resp)
  276. }
  277. func ExampleEC2_AttachVolume() {
  278. sess, err := session.NewSession()
  279. if err != nil {
  280. fmt.Println("failed to create session,", err)
  281. return
  282. }
  283. svc := ec2.New(sess)
  284. params := &ec2.AttachVolumeInput{
  285. Device: aws.String("String"), // Required
  286. InstanceId: aws.String("String"), // Required
  287. VolumeId: aws.String("String"), // Required
  288. DryRun: aws.Bool(true),
  289. }
  290. resp, err := svc.AttachVolume(params)
  291. if err != nil {
  292. // Print the error, cast err to awserr.Error to get the Code and
  293. // Message from an error.
  294. fmt.Println(err.Error())
  295. return
  296. }
  297. // Pretty-print the response data.
  298. fmt.Println(resp)
  299. }
  300. func ExampleEC2_AttachVpnGateway() {
  301. sess, err := session.NewSession()
  302. if err != nil {
  303. fmt.Println("failed to create session,", err)
  304. return
  305. }
  306. svc := ec2.New(sess)
  307. params := &ec2.AttachVpnGatewayInput{
  308. VpcId: aws.String("String"), // Required
  309. VpnGatewayId: aws.String("String"), // Required
  310. DryRun: aws.Bool(true),
  311. }
  312. resp, err := svc.AttachVpnGateway(params)
  313. if err != nil {
  314. // Print the error, cast err to awserr.Error to get the Code and
  315. // Message from an error.
  316. fmt.Println(err.Error())
  317. return
  318. }
  319. // Pretty-print the response data.
  320. fmt.Println(resp)
  321. }
  322. func ExampleEC2_AuthorizeSecurityGroupEgress() {
  323. sess, err := session.NewSession()
  324. if err != nil {
  325. fmt.Println("failed to create session,", err)
  326. return
  327. }
  328. svc := ec2.New(sess)
  329. params := &ec2.AuthorizeSecurityGroupEgressInput{
  330. GroupId: aws.String("String"), // Required
  331. CidrIp: aws.String("String"),
  332. DryRun: aws.Bool(true),
  333. FromPort: aws.Int64(1),
  334. IpPermissions: []*ec2.IpPermission{
  335. { // Required
  336. FromPort: aws.Int64(1),
  337. IpProtocol: aws.String("String"),
  338. IpRanges: []*ec2.IpRange{
  339. { // Required
  340. CidrIp: aws.String("String"),
  341. },
  342. // More values...
  343. },
  344. PrefixListIds: []*ec2.PrefixListId{
  345. { // Required
  346. PrefixListId: aws.String("String"),
  347. },
  348. // More values...
  349. },
  350. ToPort: aws.Int64(1),
  351. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  352. { // Required
  353. GroupId: aws.String("String"),
  354. GroupName: aws.String("String"),
  355. PeeringStatus: aws.String("String"),
  356. UserId: aws.String("String"),
  357. VpcId: aws.String("String"),
  358. VpcPeeringConnectionId: aws.String("String"),
  359. },
  360. // More values...
  361. },
  362. },
  363. // More values...
  364. },
  365. IpProtocol: aws.String("String"),
  366. SourceSecurityGroupName: aws.String("String"),
  367. SourceSecurityGroupOwnerId: aws.String("String"),
  368. ToPort: aws.Int64(1),
  369. }
  370. resp, err := svc.AuthorizeSecurityGroupEgress(params)
  371. if err != nil {
  372. // Print the error, cast err to awserr.Error to get the Code and
  373. // Message from an error.
  374. fmt.Println(err.Error())
  375. return
  376. }
  377. // Pretty-print the response data.
  378. fmt.Println(resp)
  379. }
  380. func ExampleEC2_AuthorizeSecurityGroupIngress() {
  381. sess, err := session.NewSession()
  382. if err != nil {
  383. fmt.Println("failed to create session,", err)
  384. return
  385. }
  386. svc := ec2.New(sess)
  387. params := &ec2.AuthorizeSecurityGroupIngressInput{
  388. CidrIp: aws.String("String"),
  389. DryRun: aws.Bool(true),
  390. FromPort: aws.Int64(1),
  391. GroupId: aws.String("String"),
  392. GroupName: aws.String("String"),
  393. IpPermissions: []*ec2.IpPermission{
  394. { // Required
  395. FromPort: aws.Int64(1),
  396. IpProtocol: aws.String("String"),
  397. IpRanges: []*ec2.IpRange{
  398. { // Required
  399. CidrIp: aws.String("String"),
  400. },
  401. // More values...
  402. },
  403. PrefixListIds: []*ec2.PrefixListId{
  404. { // Required
  405. PrefixListId: aws.String("String"),
  406. },
  407. // More values...
  408. },
  409. ToPort: aws.Int64(1),
  410. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  411. { // Required
  412. GroupId: aws.String("String"),
  413. GroupName: aws.String("String"),
  414. PeeringStatus: aws.String("String"),
  415. UserId: aws.String("String"),
  416. VpcId: aws.String("String"),
  417. VpcPeeringConnectionId: aws.String("String"),
  418. },
  419. // More values...
  420. },
  421. },
  422. // More values...
  423. },
  424. IpProtocol: aws.String("String"),
  425. SourceSecurityGroupName: aws.String("String"),
  426. SourceSecurityGroupOwnerId: aws.String("String"),
  427. ToPort: aws.Int64(1),
  428. }
  429. resp, err := svc.AuthorizeSecurityGroupIngress(params)
  430. if err != nil {
  431. // Print the error, cast err to awserr.Error to get the Code and
  432. // Message from an error.
  433. fmt.Println(err.Error())
  434. return
  435. }
  436. // Pretty-print the response data.
  437. fmt.Println(resp)
  438. }
  439. func ExampleEC2_BundleInstance() {
  440. sess, err := session.NewSession()
  441. if err != nil {
  442. fmt.Println("failed to create session,", err)
  443. return
  444. }
  445. svc := ec2.New(sess)
  446. params := &ec2.BundleInstanceInput{
  447. InstanceId: aws.String("String"), // Required
  448. Storage: &ec2.Storage{ // Required
  449. S3: &ec2.S3Storage{
  450. AWSAccessKeyId: aws.String("String"),
  451. Bucket: aws.String("String"),
  452. Prefix: aws.String("String"),
  453. UploadPolicy: []byte("PAYLOAD"),
  454. UploadPolicySignature: aws.String("String"),
  455. },
  456. },
  457. DryRun: aws.Bool(true),
  458. }
  459. resp, err := svc.BundleInstance(params)
  460. if err != nil {
  461. // Print the error, cast err to awserr.Error to get the Code and
  462. // Message from an error.
  463. fmt.Println(err.Error())
  464. return
  465. }
  466. // Pretty-print the response data.
  467. fmt.Println(resp)
  468. }
  469. func ExampleEC2_CancelBundleTask() {
  470. sess, err := session.NewSession()
  471. if err != nil {
  472. fmt.Println("failed to create session,", err)
  473. return
  474. }
  475. svc := ec2.New(sess)
  476. params := &ec2.CancelBundleTaskInput{
  477. BundleId: aws.String("String"), // Required
  478. DryRun: aws.Bool(true),
  479. }
  480. resp, err := svc.CancelBundleTask(params)
  481. if err != nil {
  482. // Print the error, cast err to awserr.Error to get the Code and
  483. // Message from an error.
  484. fmt.Println(err.Error())
  485. return
  486. }
  487. // Pretty-print the response data.
  488. fmt.Println(resp)
  489. }
  490. func ExampleEC2_CancelConversionTask() {
  491. sess, err := session.NewSession()
  492. if err != nil {
  493. fmt.Println("failed to create session,", err)
  494. return
  495. }
  496. svc := ec2.New(sess)
  497. params := &ec2.CancelConversionTaskInput{
  498. ConversionTaskId: aws.String("String"), // Required
  499. DryRun: aws.Bool(true),
  500. ReasonMessage: aws.String("String"),
  501. }
  502. resp, err := svc.CancelConversionTask(params)
  503. if err != nil {
  504. // Print the error, cast err to awserr.Error to get the Code and
  505. // Message from an error.
  506. fmt.Println(err.Error())
  507. return
  508. }
  509. // Pretty-print the response data.
  510. fmt.Println(resp)
  511. }
  512. func ExampleEC2_CancelExportTask() {
  513. sess, err := session.NewSession()
  514. if err != nil {
  515. fmt.Println("failed to create session,", err)
  516. return
  517. }
  518. svc := ec2.New(sess)
  519. params := &ec2.CancelExportTaskInput{
  520. ExportTaskId: aws.String("String"), // Required
  521. }
  522. resp, err := svc.CancelExportTask(params)
  523. if err != nil {
  524. // Print the error, cast err to awserr.Error to get the Code and
  525. // Message from an error.
  526. fmt.Println(err.Error())
  527. return
  528. }
  529. // Pretty-print the response data.
  530. fmt.Println(resp)
  531. }
  532. func ExampleEC2_CancelImportTask() {
  533. sess, err := session.NewSession()
  534. if err != nil {
  535. fmt.Println("failed to create session,", err)
  536. return
  537. }
  538. svc := ec2.New(sess)
  539. params := &ec2.CancelImportTaskInput{
  540. CancelReason: aws.String("String"),
  541. DryRun: aws.Bool(true),
  542. ImportTaskId: aws.String("String"),
  543. }
  544. resp, err := svc.CancelImportTask(params)
  545. if err != nil {
  546. // Print the error, cast err to awserr.Error to get the Code and
  547. // Message from an error.
  548. fmt.Println(err.Error())
  549. return
  550. }
  551. // Pretty-print the response data.
  552. fmt.Println(resp)
  553. }
  554. func ExampleEC2_CancelReservedInstancesListing() {
  555. sess, err := session.NewSession()
  556. if err != nil {
  557. fmt.Println("failed to create session,", err)
  558. return
  559. }
  560. svc := ec2.New(sess)
  561. params := &ec2.CancelReservedInstancesListingInput{
  562. ReservedInstancesListingId: aws.String("String"), // Required
  563. }
  564. resp, err := svc.CancelReservedInstancesListing(params)
  565. if err != nil {
  566. // Print the error, cast err to awserr.Error to get the Code and
  567. // Message from an error.
  568. fmt.Println(err.Error())
  569. return
  570. }
  571. // Pretty-print the response data.
  572. fmt.Println(resp)
  573. }
  574. func ExampleEC2_CancelSpotFleetRequests() {
  575. sess, err := session.NewSession()
  576. if err != nil {
  577. fmt.Println("failed to create session,", err)
  578. return
  579. }
  580. svc := ec2.New(sess)
  581. params := &ec2.CancelSpotFleetRequestsInput{
  582. SpotFleetRequestIds: []*string{ // Required
  583. aws.String("String"), // Required
  584. // More values...
  585. },
  586. TerminateInstances: aws.Bool(true), // Required
  587. DryRun: aws.Bool(true),
  588. }
  589. resp, err := svc.CancelSpotFleetRequests(params)
  590. if err != nil {
  591. // Print the error, cast err to awserr.Error to get the Code and
  592. // Message from an error.
  593. fmt.Println(err.Error())
  594. return
  595. }
  596. // Pretty-print the response data.
  597. fmt.Println(resp)
  598. }
  599. func ExampleEC2_CancelSpotInstanceRequests() {
  600. sess, err := session.NewSession()
  601. if err != nil {
  602. fmt.Println("failed to create session,", err)
  603. return
  604. }
  605. svc := ec2.New(sess)
  606. params := &ec2.CancelSpotInstanceRequestsInput{
  607. SpotInstanceRequestIds: []*string{ // Required
  608. aws.String("String"), // Required
  609. // More values...
  610. },
  611. DryRun: aws.Bool(true),
  612. }
  613. resp, err := svc.CancelSpotInstanceRequests(params)
  614. if err != nil {
  615. // Print the error, cast err to awserr.Error to get the Code and
  616. // Message from an error.
  617. fmt.Println(err.Error())
  618. return
  619. }
  620. // Pretty-print the response data.
  621. fmt.Println(resp)
  622. }
  623. func ExampleEC2_ConfirmProductInstance() {
  624. sess, err := session.NewSession()
  625. if err != nil {
  626. fmt.Println("failed to create session,", err)
  627. return
  628. }
  629. svc := ec2.New(sess)
  630. params := &ec2.ConfirmProductInstanceInput{
  631. InstanceId: aws.String("String"), // Required
  632. ProductCode: aws.String("String"), // Required
  633. DryRun: aws.Bool(true),
  634. }
  635. resp, err := svc.ConfirmProductInstance(params)
  636. if err != nil {
  637. // Print the error, cast err to awserr.Error to get the Code and
  638. // Message from an error.
  639. fmt.Println(err.Error())
  640. return
  641. }
  642. // Pretty-print the response data.
  643. fmt.Println(resp)
  644. }
  645. func ExampleEC2_CopyImage() {
  646. sess, err := session.NewSession()
  647. if err != nil {
  648. fmt.Println("failed to create session,", err)
  649. return
  650. }
  651. svc := ec2.New(sess)
  652. params := &ec2.CopyImageInput{
  653. Name: aws.String("String"), // Required
  654. SourceImageId: aws.String("String"), // Required
  655. SourceRegion: aws.String("String"), // Required
  656. ClientToken: aws.String("String"),
  657. Description: aws.String("String"),
  658. DryRun: aws.Bool(true),
  659. Encrypted: aws.Bool(true),
  660. KmsKeyId: aws.String("String"),
  661. }
  662. resp, err := svc.CopyImage(params)
  663. if err != nil {
  664. // Print the error, cast err to awserr.Error to get the Code and
  665. // Message from an error.
  666. fmt.Println(err.Error())
  667. return
  668. }
  669. // Pretty-print the response data.
  670. fmt.Println(resp)
  671. }
  672. func ExampleEC2_CopySnapshot() {
  673. sess, err := session.NewSession()
  674. if err != nil {
  675. fmt.Println("failed to create session,", err)
  676. return
  677. }
  678. svc := ec2.New(sess)
  679. params := &ec2.CopySnapshotInput{
  680. SourceRegion: aws.String("String"), // Required
  681. SourceSnapshotId: aws.String("String"), // Required
  682. Description: aws.String("String"),
  683. DestinationRegion: aws.String("String"),
  684. DryRun: aws.Bool(true),
  685. Encrypted: aws.Bool(true),
  686. KmsKeyId: aws.String("String"),
  687. PresignedUrl: aws.String("String"),
  688. }
  689. resp, err := svc.CopySnapshot(params)
  690. if err != nil {
  691. // Print the error, cast err to awserr.Error to get the Code and
  692. // Message from an error.
  693. fmt.Println(err.Error())
  694. return
  695. }
  696. // Pretty-print the response data.
  697. fmt.Println(resp)
  698. }
  699. func ExampleEC2_CreateCustomerGateway() {
  700. sess, err := session.NewSession()
  701. if err != nil {
  702. fmt.Println("failed to create session,", err)
  703. return
  704. }
  705. svc := ec2.New(sess)
  706. params := &ec2.CreateCustomerGatewayInput{
  707. BgpAsn: aws.Int64(1), // Required
  708. PublicIp: aws.String("String"), // Required
  709. Type: aws.String("GatewayType"), // Required
  710. DryRun: aws.Bool(true),
  711. }
  712. resp, err := svc.CreateCustomerGateway(params)
  713. if err != nil {
  714. // Print the error, cast err to awserr.Error to get the Code and
  715. // Message from an error.
  716. fmt.Println(err.Error())
  717. return
  718. }
  719. // Pretty-print the response data.
  720. fmt.Println(resp)
  721. }
  722. func ExampleEC2_CreateDhcpOptions() {
  723. sess, err := session.NewSession()
  724. if err != nil {
  725. fmt.Println("failed to create session,", err)
  726. return
  727. }
  728. svc := ec2.New(sess)
  729. params := &ec2.CreateDhcpOptionsInput{
  730. DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required
  731. { // Required
  732. Key: aws.String("String"),
  733. Values: []*string{
  734. aws.String("String"), // Required
  735. // More values...
  736. },
  737. },
  738. // More values...
  739. },
  740. DryRun: aws.Bool(true),
  741. }
  742. resp, err := svc.CreateDhcpOptions(params)
  743. if err != nil {
  744. // Print the error, cast err to awserr.Error to get the Code and
  745. // Message from an error.
  746. fmt.Println(err.Error())
  747. return
  748. }
  749. // Pretty-print the response data.
  750. fmt.Println(resp)
  751. }
  752. func ExampleEC2_CreateFlowLogs() {
  753. sess, err := session.NewSession()
  754. if err != nil {
  755. fmt.Println("failed to create session,", err)
  756. return
  757. }
  758. svc := ec2.New(sess)
  759. params := &ec2.CreateFlowLogsInput{
  760. DeliverLogsPermissionArn: aws.String("String"), // Required
  761. LogGroupName: aws.String("String"), // Required
  762. ResourceIds: []*string{ // Required
  763. aws.String("String"), // Required
  764. // More values...
  765. },
  766. ResourceType: aws.String("FlowLogsResourceType"), // Required
  767. TrafficType: aws.String("TrafficType"), // Required
  768. ClientToken: aws.String("String"),
  769. }
  770. resp, err := svc.CreateFlowLogs(params)
  771. if err != nil {
  772. // Print the error, cast err to awserr.Error to get the Code and
  773. // Message from an error.
  774. fmt.Println(err.Error())
  775. return
  776. }
  777. // Pretty-print the response data.
  778. fmt.Println(resp)
  779. }
  780. func ExampleEC2_CreateImage() {
  781. sess, err := session.NewSession()
  782. if err != nil {
  783. fmt.Println("failed to create session,", err)
  784. return
  785. }
  786. svc := ec2.New(sess)
  787. params := &ec2.CreateImageInput{
  788. InstanceId: aws.String("String"), // Required
  789. Name: aws.String("String"), // Required
  790. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  791. { // Required
  792. DeviceName: aws.String("String"),
  793. Ebs: &ec2.EbsBlockDevice{
  794. DeleteOnTermination: aws.Bool(true),
  795. Encrypted: aws.Bool(true),
  796. Iops: aws.Int64(1),
  797. SnapshotId: aws.String("String"),
  798. VolumeSize: aws.Int64(1),
  799. VolumeType: aws.String("VolumeType"),
  800. },
  801. NoDevice: aws.String("String"),
  802. VirtualName: aws.String("String"),
  803. },
  804. // More values...
  805. },
  806. Description: aws.String("String"),
  807. DryRun: aws.Bool(true),
  808. NoReboot: aws.Bool(true),
  809. }
  810. resp, err := svc.CreateImage(params)
  811. if err != nil {
  812. // Print the error, cast err to awserr.Error to get the Code and
  813. // Message from an error.
  814. fmt.Println(err.Error())
  815. return
  816. }
  817. // Pretty-print the response data.
  818. fmt.Println(resp)
  819. }
  820. func ExampleEC2_CreateInstanceExportTask() {
  821. sess, err := session.NewSession()
  822. if err != nil {
  823. fmt.Println("failed to create session,", err)
  824. return
  825. }
  826. svc := ec2.New(sess)
  827. params := &ec2.CreateInstanceExportTaskInput{
  828. InstanceId: aws.String("String"), // Required
  829. Description: aws.String("String"),
  830. ExportToS3Task: &ec2.ExportToS3TaskSpecification{
  831. ContainerFormat: aws.String("ContainerFormat"),
  832. DiskImageFormat: aws.String("DiskImageFormat"),
  833. S3Bucket: aws.String("String"),
  834. S3Prefix: aws.String("String"),
  835. },
  836. TargetEnvironment: aws.String("ExportEnvironment"),
  837. }
  838. resp, err := svc.CreateInstanceExportTask(params)
  839. if err != nil {
  840. // Print the error, cast err to awserr.Error to get the Code and
  841. // Message from an error.
  842. fmt.Println(err.Error())
  843. return
  844. }
  845. // Pretty-print the response data.
  846. fmt.Println(resp)
  847. }
  848. func ExampleEC2_CreateInternetGateway() {
  849. sess, err := session.NewSession()
  850. if err != nil {
  851. fmt.Println("failed to create session,", err)
  852. return
  853. }
  854. svc := ec2.New(sess)
  855. params := &ec2.CreateInternetGatewayInput{
  856. DryRun: aws.Bool(true),
  857. }
  858. resp, err := svc.CreateInternetGateway(params)
  859. if err != nil {
  860. // Print the error, cast err to awserr.Error to get the Code and
  861. // Message from an error.
  862. fmt.Println(err.Error())
  863. return
  864. }
  865. // Pretty-print the response data.
  866. fmt.Println(resp)
  867. }
  868. func ExampleEC2_CreateKeyPair() {
  869. sess, err := session.NewSession()
  870. if err != nil {
  871. fmt.Println("failed to create session,", err)
  872. return
  873. }
  874. svc := ec2.New(sess)
  875. params := &ec2.CreateKeyPairInput{
  876. KeyName: aws.String("String"), // Required
  877. DryRun: aws.Bool(true),
  878. }
  879. resp, err := svc.CreateKeyPair(params)
  880. if err != nil {
  881. // Print the error, cast err to awserr.Error to get the Code and
  882. // Message from an error.
  883. fmt.Println(err.Error())
  884. return
  885. }
  886. // Pretty-print the response data.
  887. fmt.Println(resp)
  888. }
  889. func ExampleEC2_CreateNatGateway() {
  890. sess, err := session.NewSession()
  891. if err != nil {
  892. fmt.Println("failed to create session,", err)
  893. return
  894. }
  895. svc := ec2.New(sess)
  896. params := &ec2.CreateNatGatewayInput{
  897. AllocationId: aws.String("String"), // Required
  898. SubnetId: aws.String("String"), // Required
  899. ClientToken: aws.String("String"),
  900. }
  901. resp, err := svc.CreateNatGateway(params)
  902. if err != nil {
  903. // Print the error, cast err to awserr.Error to get the Code and
  904. // Message from an error.
  905. fmt.Println(err.Error())
  906. return
  907. }
  908. // Pretty-print the response data.
  909. fmt.Println(resp)
  910. }
  911. func ExampleEC2_CreateNetworkAcl() {
  912. sess, err := session.NewSession()
  913. if err != nil {
  914. fmt.Println("failed to create session,", err)
  915. return
  916. }
  917. svc := ec2.New(sess)
  918. params := &ec2.CreateNetworkAclInput{
  919. VpcId: aws.String("String"), // Required
  920. DryRun: aws.Bool(true),
  921. }
  922. resp, err := svc.CreateNetworkAcl(params)
  923. if err != nil {
  924. // Print the error, cast err to awserr.Error to get the Code and
  925. // Message from an error.
  926. fmt.Println(err.Error())
  927. return
  928. }
  929. // Pretty-print the response data.
  930. fmt.Println(resp)
  931. }
  932. func ExampleEC2_CreateNetworkAclEntry() {
  933. sess, err := session.NewSession()
  934. if err != nil {
  935. fmt.Println("failed to create session,", err)
  936. return
  937. }
  938. svc := ec2.New(sess)
  939. params := &ec2.CreateNetworkAclEntryInput{
  940. CidrBlock: aws.String("String"), // Required
  941. Egress: aws.Bool(true), // Required
  942. NetworkAclId: aws.String("String"), // Required
  943. Protocol: aws.String("String"), // Required
  944. RuleAction: aws.String("RuleAction"), // Required
  945. RuleNumber: aws.Int64(1), // Required
  946. DryRun: aws.Bool(true),
  947. IcmpTypeCode: &ec2.IcmpTypeCode{
  948. Code: aws.Int64(1),
  949. Type: aws.Int64(1),
  950. },
  951. PortRange: &ec2.PortRange{
  952. From: aws.Int64(1),
  953. To: aws.Int64(1),
  954. },
  955. }
  956. resp, err := svc.CreateNetworkAclEntry(params)
  957. if err != nil {
  958. // Print the error, cast err to awserr.Error to get the Code and
  959. // Message from an error.
  960. fmt.Println(err.Error())
  961. return
  962. }
  963. // Pretty-print the response data.
  964. fmt.Println(resp)
  965. }
  966. func ExampleEC2_CreateNetworkInterface() {
  967. sess, err := session.NewSession()
  968. if err != nil {
  969. fmt.Println("failed to create session,", err)
  970. return
  971. }
  972. svc := ec2.New(sess)
  973. params := &ec2.CreateNetworkInterfaceInput{
  974. SubnetId: aws.String("String"), // Required
  975. Description: aws.String("String"),
  976. DryRun: aws.Bool(true),
  977. Groups: []*string{
  978. aws.String("String"), // Required
  979. // More values...
  980. },
  981. PrivateIpAddress: aws.String("String"),
  982. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  983. { // Required
  984. PrivateIpAddress: aws.String("String"), // Required
  985. Primary: aws.Bool(true),
  986. },
  987. // More values...
  988. },
  989. SecondaryPrivateIpAddressCount: aws.Int64(1),
  990. }
  991. resp, err := svc.CreateNetworkInterface(params)
  992. if err != nil {
  993. // Print the error, cast err to awserr.Error to get the Code and
  994. // Message from an error.
  995. fmt.Println(err.Error())
  996. return
  997. }
  998. // Pretty-print the response data.
  999. fmt.Println(resp)
  1000. }
  1001. func ExampleEC2_CreatePlacementGroup() {
  1002. sess, err := session.NewSession()
  1003. if err != nil {
  1004. fmt.Println("failed to create session,", err)
  1005. return
  1006. }
  1007. svc := ec2.New(sess)
  1008. params := &ec2.CreatePlacementGroupInput{
  1009. GroupName: aws.String("String"), // Required
  1010. Strategy: aws.String("PlacementStrategy"), // Required
  1011. DryRun: aws.Bool(true),
  1012. }
  1013. resp, err := svc.CreatePlacementGroup(params)
  1014. if err != nil {
  1015. // Print the error, cast err to awserr.Error to get the Code and
  1016. // Message from an error.
  1017. fmt.Println(err.Error())
  1018. return
  1019. }
  1020. // Pretty-print the response data.
  1021. fmt.Println(resp)
  1022. }
  1023. func ExampleEC2_CreateReservedInstancesListing() {
  1024. sess, err := session.NewSession()
  1025. if err != nil {
  1026. fmt.Println("failed to create session,", err)
  1027. return
  1028. }
  1029. svc := ec2.New(sess)
  1030. params := &ec2.CreateReservedInstancesListingInput{
  1031. ClientToken: aws.String("String"), // Required
  1032. InstanceCount: aws.Int64(1), // Required
  1033. PriceSchedules: []*ec2.PriceScheduleSpecification{ // Required
  1034. { // Required
  1035. CurrencyCode: aws.String("CurrencyCodeValues"),
  1036. Price: aws.Float64(1.0),
  1037. Term: aws.Int64(1),
  1038. },
  1039. // More values...
  1040. },
  1041. ReservedInstancesId: aws.String("String"), // Required
  1042. }
  1043. resp, err := svc.CreateReservedInstancesListing(params)
  1044. if err != nil {
  1045. // Print the error, cast err to awserr.Error to get the Code and
  1046. // Message from an error.
  1047. fmt.Println(err.Error())
  1048. return
  1049. }
  1050. // Pretty-print the response data.
  1051. fmt.Println(resp)
  1052. }
  1053. func ExampleEC2_CreateRoute() {
  1054. sess, err := session.NewSession()
  1055. if err != nil {
  1056. fmt.Println("failed to create session,", err)
  1057. return
  1058. }
  1059. svc := ec2.New(sess)
  1060. params := &ec2.CreateRouteInput{
  1061. DestinationCidrBlock: aws.String("String"), // Required
  1062. RouteTableId: aws.String("String"), // Required
  1063. DryRun: aws.Bool(true),
  1064. GatewayId: aws.String("String"),
  1065. InstanceId: aws.String("String"),
  1066. NatGatewayId: aws.String("String"),
  1067. NetworkInterfaceId: aws.String("String"),
  1068. VpcPeeringConnectionId: aws.String("String"),
  1069. }
  1070. resp, err := svc.CreateRoute(params)
  1071. if err != nil {
  1072. // Print the error, cast err to awserr.Error to get the Code and
  1073. // Message from an error.
  1074. fmt.Println(err.Error())
  1075. return
  1076. }
  1077. // Pretty-print the response data.
  1078. fmt.Println(resp)
  1079. }
  1080. func ExampleEC2_CreateRouteTable() {
  1081. sess, err := session.NewSession()
  1082. if err != nil {
  1083. fmt.Println("failed to create session,", err)
  1084. return
  1085. }
  1086. svc := ec2.New(sess)
  1087. params := &ec2.CreateRouteTableInput{
  1088. VpcId: aws.String("String"), // Required
  1089. DryRun: aws.Bool(true),
  1090. }
  1091. resp, err := svc.CreateRouteTable(params)
  1092. if err != nil {
  1093. // Print the error, cast err to awserr.Error to get the Code and
  1094. // Message from an error.
  1095. fmt.Println(err.Error())
  1096. return
  1097. }
  1098. // Pretty-print the response data.
  1099. fmt.Println(resp)
  1100. }
  1101. func ExampleEC2_CreateSecurityGroup() {
  1102. sess, err := session.NewSession()
  1103. if err != nil {
  1104. fmt.Println("failed to create session,", err)
  1105. return
  1106. }
  1107. svc := ec2.New(sess)
  1108. params := &ec2.CreateSecurityGroupInput{
  1109. Description: aws.String("String"), // Required
  1110. GroupName: aws.String("String"), // Required
  1111. DryRun: aws.Bool(true),
  1112. VpcId: aws.String("String"),
  1113. }
  1114. resp, err := svc.CreateSecurityGroup(params)
  1115. if err != nil {
  1116. // Print the error, cast err to awserr.Error to get the Code and
  1117. // Message from an error.
  1118. fmt.Println(err.Error())
  1119. return
  1120. }
  1121. // Pretty-print the response data.
  1122. fmt.Println(resp)
  1123. }
  1124. func ExampleEC2_CreateSnapshot() {
  1125. sess, err := session.NewSession()
  1126. if err != nil {
  1127. fmt.Println("failed to create session,", err)
  1128. return
  1129. }
  1130. svc := ec2.New(sess)
  1131. params := &ec2.CreateSnapshotInput{
  1132. VolumeId: aws.String("String"), // Required
  1133. Description: aws.String("String"),
  1134. DryRun: aws.Bool(true),
  1135. }
  1136. resp, err := svc.CreateSnapshot(params)
  1137. if err != nil {
  1138. // Print the error, cast err to awserr.Error to get the Code and
  1139. // Message from an error.
  1140. fmt.Println(err.Error())
  1141. return
  1142. }
  1143. // Pretty-print the response data.
  1144. fmt.Println(resp)
  1145. }
  1146. func ExampleEC2_CreateSpotDatafeedSubscription() {
  1147. sess, err := session.NewSession()
  1148. if err != nil {
  1149. fmt.Println("failed to create session,", err)
  1150. return
  1151. }
  1152. svc := ec2.New(sess)
  1153. params := &ec2.CreateSpotDatafeedSubscriptionInput{
  1154. Bucket: aws.String("String"), // Required
  1155. DryRun: aws.Bool(true),
  1156. Prefix: aws.String("String"),
  1157. }
  1158. resp, err := svc.CreateSpotDatafeedSubscription(params)
  1159. if err != nil {
  1160. // Print the error, cast err to awserr.Error to get the Code and
  1161. // Message from an error.
  1162. fmt.Println(err.Error())
  1163. return
  1164. }
  1165. // Pretty-print the response data.
  1166. fmt.Println(resp)
  1167. }
  1168. func ExampleEC2_CreateSubnet() {
  1169. sess, err := session.NewSession()
  1170. if err != nil {
  1171. fmt.Println("failed to create session,", err)
  1172. return
  1173. }
  1174. svc := ec2.New(sess)
  1175. params := &ec2.CreateSubnetInput{
  1176. CidrBlock: aws.String("String"), // Required
  1177. VpcId: aws.String("String"), // Required
  1178. AvailabilityZone: aws.String("String"),
  1179. DryRun: aws.Bool(true),
  1180. }
  1181. resp, err := svc.CreateSubnet(params)
  1182. if err != nil {
  1183. // Print the error, cast err to awserr.Error to get the Code and
  1184. // Message from an error.
  1185. fmt.Println(err.Error())
  1186. return
  1187. }
  1188. // Pretty-print the response data.
  1189. fmt.Println(resp)
  1190. }
  1191. func ExampleEC2_CreateTags() {
  1192. sess, err := session.NewSession()
  1193. if err != nil {
  1194. fmt.Println("failed to create session,", err)
  1195. return
  1196. }
  1197. svc := ec2.New(sess)
  1198. params := &ec2.CreateTagsInput{
  1199. Resources: []*string{ // Required
  1200. aws.String("String"), // Required
  1201. // More values...
  1202. },
  1203. Tags: []*ec2.Tag{ // Required
  1204. { // Required
  1205. Key: aws.String("String"),
  1206. Value: aws.String("String"),
  1207. },
  1208. // More values...
  1209. },
  1210. DryRun: aws.Bool(true),
  1211. }
  1212. resp, err := svc.CreateTags(params)
  1213. if err != nil {
  1214. // Print the error, cast err to awserr.Error to get the Code and
  1215. // Message from an error.
  1216. fmt.Println(err.Error())
  1217. return
  1218. }
  1219. // Pretty-print the response data.
  1220. fmt.Println(resp)
  1221. }
  1222. func ExampleEC2_CreateVolume() {
  1223. sess, err := session.NewSession()
  1224. if err != nil {
  1225. fmt.Println("failed to create session,", err)
  1226. return
  1227. }
  1228. svc := ec2.New(sess)
  1229. params := &ec2.CreateVolumeInput{
  1230. AvailabilityZone: aws.String("String"), // Required
  1231. DryRun: aws.Bool(true),
  1232. Encrypted: aws.Bool(true),
  1233. Iops: aws.Int64(1),
  1234. KmsKeyId: aws.String("String"),
  1235. Size: aws.Int64(1),
  1236. SnapshotId: aws.String("String"),
  1237. VolumeType: aws.String("VolumeType"),
  1238. }
  1239. resp, err := svc.CreateVolume(params)
  1240. if err != nil {
  1241. // Print the error, cast err to awserr.Error to get the Code and
  1242. // Message from an error.
  1243. fmt.Println(err.Error())
  1244. return
  1245. }
  1246. // Pretty-print the response data.
  1247. fmt.Println(resp)
  1248. }
  1249. func ExampleEC2_CreateVpc() {
  1250. sess, err := session.NewSession()
  1251. if err != nil {
  1252. fmt.Println("failed to create session,", err)
  1253. return
  1254. }
  1255. svc := ec2.New(sess)
  1256. params := &ec2.CreateVpcInput{
  1257. CidrBlock: aws.String("String"), // Required
  1258. DryRun: aws.Bool(true),
  1259. InstanceTenancy: aws.String("Tenancy"),
  1260. }
  1261. resp, err := svc.CreateVpc(params)
  1262. if err != nil {
  1263. // Print the error, cast err to awserr.Error to get the Code and
  1264. // Message from an error.
  1265. fmt.Println(err.Error())
  1266. return
  1267. }
  1268. // Pretty-print the response data.
  1269. fmt.Println(resp)
  1270. }
  1271. func ExampleEC2_CreateVpcEndpoint() {
  1272. sess, err := session.NewSession()
  1273. if err != nil {
  1274. fmt.Println("failed to create session,", err)
  1275. return
  1276. }
  1277. svc := ec2.New(sess)
  1278. params := &ec2.CreateVpcEndpointInput{
  1279. ServiceName: aws.String("String"), // Required
  1280. VpcId: aws.String("String"), // Required
  1281. ClientToken: aws.String("String"),
  1282. DryRun: aws.Bool(true),
  1283. PolicyDocument: aws.String("String"),
  1284. RouteTableIds: []*string{
  1285. aws.String("String"), // Required
  1286. // More values...
  1287. },
  1288. }
  1289. resp, err := svc.CreateVpcEndpoint(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_CreateVpcPeeringConnection() {
  1300. sess, err := session.NewSession()
  1301. if err != nil {
  1302. fmt.Println("failed to create session,", err)
  1303. return
  1304. }
  1305. svc := ec2.New(sess)
  1306. params := &ec2.CreateVpcPeeringConnectionInput{
  1307. DryRun: aws.Bool(true),
  1308. PeerOwnerId: aws.String("String"),
  1309. PeerVpcId: aws.String("String"),
  1310. VpcId: aws.String("String"),
  1311. }
  1312. resp, err := svc.CreateVpcPeeringConnection(params)
  1313. if err != nil {
  1314. // Print the error, cast err to awserr.Error to get the Code and
  1315. // Message from an error.
  1316. fmt.Println(err.Error())
  1317. return
  1318. }
  1319. // Pretty-print the response data.
  1320. fmt.Println(resp)
  1321. }
  1322. func ExampleEC2_CreateVpnConnection() {
  1323. sess, err := session.NewSession()
  1324. if err != nil {
  1325. fmt.Println("failed to create session,", err)
  1326. return
  1327. }
  1328. svc := ec2.New(sess)
  1329. params := &ec2.CreateVpnConnectionInput{
  1330. CustomerGatewayId: aws.String("String"), // Required
  1331. Type: aws.String("String"), // Required
  1332. VpnGatewayId: aws.String("String"), // Required
  1333. DryRun: aws.Bool(true),
  1334. Options: &ec2.VpnConnectionOptionsSpecification{
  1335. StaticRoutesOnly: aws.Bool(true),
  1336. },
  1337. }
  1338. resp, err := svc.CreateVpnConnection(params)
  1339. if err != nil {
  1340. // Print the error, cast err to awserr.Error to get the Code and
  1341. // Message from an error.
  1342. fmt.Println(err.Error())
  1343. return
  1344. }
  1345. // Pretty-print the response data.
  1346. fmt.Println(resp)
  1347. }
  1348. func ExampleEC2_CreateVpnConnectionRoute() {
  1349. sess, err := session.NewSession()
  1350. if err != nil {
  1351. fmt.Println("failed to create session,", err)
  1352. return
  1353. }
  1354. svc := ec2.New(sess)
  1355. params := &ec2.CreateVpnConnectionRouteInput{
  1356. DestinationCidrBlock: aws.String("String"), // Required
  1357. VpnConnectionId: aws.String("String"), // Required
  1358. }
  1359. resp, err := svc.CreateVpnConnectionRoute(params)
  1360. if err != nil {
  1361. // Print the error, cast err to awserr.Error to get the Code and
  1362. // Message from an error.
  1363. fmt.Println(err.Error())
  1364. return
  1365. }
  1366. // Pretty-print the response data.
  1367. fmt.Println(resp)
  1368. }
  1369. func ExampleEC2_CreateVpnGateway() {
  1370. sess, err := session.NewSession()
  1371. if err != nil {
  1372. fmt.Println("failed to create session,", err)
  1373. return
  1374. }
  1375. svc := ec2.New(sess)
  1376. params := &ec2.CreateVpnGatewayInput{
  1377. Type: aws.String("GatewayType"), // Required
  1378. AvailabilityZone: aws.String("String"),
  1379. DryRun: aws.Bool(true),
  1380. }
  1381. resp, err := svc.CreateVpnGateway(params)
  1382. if err != nil {
  1383. // Print the error, cast err to awserr.Error to get the Code and
  1384. // Message from an error.
  1385. fmt.Println(err.Error())
  1386. return
  1387. }
  1388. // Pretty-print the response data.
  1389. fmt.Println(resp)
  1390. }
  1391. func ExampleEC2_DeleteCustomerGateway() {
  1392. sess, err := session.NewSession()
  1393. if err != nil {
  1394. fmt.Println("failed to create session,", err)
  1395. return
  1396. }
  1397. svc := ec2.New(sess)
  1398. params := &ec2.DeleteCustomerGatewayInput{
  1399. CustomerGatewayId: aws.String("String"), // Required
  1400. DryRun: aws.Bool(true),
  1401. }
  1402. resp, err := svc.DeleteCustomerGateway(params)
  1403. if err != nil {
  1404. // Print the error, cast err to awserr.Error to get the Code and
  1405. // Message from an error.
  1406. fmt.Println(err.Error())
  1407. return
  1408. }
  1409. // Pretty-print the response data.
  1410. fmt.Println(resp)
  1411. }
  1412. func ExampleEC2_DeleteDhcpOptions() {
  1413. sess, err := session.NewSession()
  1414. if err != nil {
  1415. fmt.Println("failed to create session,", err)
  1416. return
  1417. }
  1418. svc := ec2.New(sess)
  1419. params := &ec2.DeleteDhcpOptionsInput{
  1420. DhcpOptionsId: aws.String("String"), // Required
  1421. DryRun: aws.Bool(true),
  1422. }
  1423. resp, err := svc.DeleteDhcpOptions(params)
  1424. if err != nil {
  1425. // Print the error, cast err to awserr.Error to get the Code and
  1426. // Message from an error.
  1427. fmt.Println(err.Error())
  1428. return
  1429. }
  1430. // Pretty-print the response data.
  1431. fmt.Println(resp)
  1432. }
  1433. func ExampleEC2_DeleteFlowLogs() {
  1434. sess, err := session.NewSession()
  1435. if err != nil {
  1436. fmt.Println("failed to create session,", err)
  1437. return
  1438. }
  1439. svc := ec2.New(sess)
  1440. params := &ec2.DeleteFlowLogsInput{
  1441. FlowLogIds: []*string{ // Required
  1442. aws.String("String"), // Required
  1443. // More values...
  1444. },
  1445. }
  1446. resp, err := svc.DeleteFlowLogs(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_DeleteInternetGateway() {
  1457. sess, err := session.NewSession()
  1458. if err != nil {
  1459. fmt.Println("failed to create session,", err)
  1460. return
  1461. }
  1462. svc := ec2.New(sess)
  1463. params := &ec2.DeleteInternetGatewayInput{
  1464. InternetGatewayId: aws.String("String"), // Required
  1465. DryRun: aws.Bool(true),
  1466. }
  1467. resp, err := svc.DeleteInternetGateway(params)
  1468. if err != nil {
  1469. // Print the error, cast err to awserr.Error to get the Code and
  1470. // Message from an error.
  1471. fmt.Println(err.Error())
  1472. return
  1473. }
  1474. // Pretty-print the response data.
  1475. fmt.Println(resp)
  1476. }
  1477. func ExampleEC2_DeleteKeyPair() {
  1478. sess, err := session.NewSession()
  1479. if err != nil {
  1480. fmt.Println("failed to create session,", err)
  1481. return
  1482. }
  1483. svc := ec2.New(sess)
  1484. params := &ec2.DeleteKeyPairInput{
  1485. KeyName: aws.String("String"), // Required
  1486. DryRun: aws.Bool(true),
  1487. }
  1488. resp, err := svc.DeleteKeyPair(params)
  1489. if err != nil {
  1490. // Print the error, cast err to awserr.Error to get the Code and
  1491. // Message from an error.
  1492. fmt.Println(err.Error())
  1493. return
  1494. }
  1495. // Pretty-print the response data.
  1496. fmt.Println(resp)
  1497. }
  1498. func ExampleEC2_DeleteNatGateway() {
  1499. sess, err := session.NewSession()
  1500. if err != nil {
  1501. fmt.Println("failed to create session,", err)
  1502. return
  1503. }
  1504. svc := ec2.New(sess)
  1505. params := &ec2.DeleteNatGatewayInput{
  1506. NatGatewayId: aws.String("String"), // Required
  1507. }
  1508. resp, err := svc.DeleteNatGateway(params)
  1509. if err != nil {
  1510. // Print the error, cast err to awserr.Error to get the Code and
  1511. // Message from an error.
  1512. fmt.Println(err.Error())
  1513. return
  1514. }
  1515. // Pretty-print the response data.
  1516. fmt.Println(resp)
  1517. }
  1518. func ExampleEC2_DeleteNetworkAcl() {
  1519. sess, err := session.NewSession()
  1520. if err != nil {
  1521. fmt.Println("failed to create session,", err)
  1522. return
  1523. }
  1524. svc := ec2.New(sess)
  1525. params := &ec2.DeleteNetworkAclInput{
  1526. NetworkAclId: aws.String("String"), // Required
  1527. DryRun: aws.Bool(true),
  1528. }
  1529. resp, err := svc.DeleteNetworkAcl(params)
  1530. if err != nil {
  1531. // Print the error, cast err to awserr.Error to get the Code and
  1532. // Message from an error.
  1533. fmt.Println(err.Error())
  1534. return
  1535. }
  1536. // Pretty-print the response data.
  1537. fmt.Println(resp)
  1538. }
  1539. func ExampleEC2_DeleteNetworkAclEntry() {
  1540. sess, err := session.NewSession()
  1541. if err != nil {
  1542. fmt.Println("failed to create session,", err)
  1543. return
  1544. }
  1545. svc := ec2.New(sess)
  1546. params := &ec2.DeleteNetworkAclEntryInput{
  1547. Egress: aws.Bool(true), // Required
  1548. NetworkAclId: aws.String("String"), // Required
  1549. RuleNumber: aws.Int64(1), // Required
  1550. DryRun: aws.Bool(true),
  1551. }
  1552. resp, err := svc.DeleteNetworkAclEntry(params)
  1553. if err != nil {
  1554. // Print the error, cast err to awserr.Error to get the Code and
  1555. // Message from an error.
  1556. fmt.Println(err.Error())
  1557. return
  1558. }
  1559. // Pretty-print the response data.
  1560. fmt.Println(resp)
  1561. }
  1562. func ExampleEC2_DeleteNetworkInterface() {
  1563. sess, err := session.NewSession()
  1564. if err != nil {
  1565. fmt.Println("failed to create session,", err)
  1566. return
  1567. }
  1568. svc := ec2.New(sess)
  1569. params := &ec2.DeleteNetworkInterfaceInput{
  1570. NetworkInterfaceId: aws.String("String"), // Required
  1571. DryRun: aws.Bool(true),
  1572. }
  1573. resp, err := svc.DeleteNetworkInterface(params)
  1574. if err != nil {
  1575. // Print the error, cast err to awserr.Error to get the Code and
  1576. // Message from an error.
  1577. fmt.Println(err.Error())
  1578. return
  1579. }
  1580. // Pretty-print the response data.
  1581. fmt.Println(resp)
  1582. }
  1583. func ExampleEC2_DeletePlacementGroup() {
  1584. sess, err := session.NewSession()
  1585. if err != nil {
  1586. fmt.Println("failed to create session,", err)
  1587. return
  1588. }
  1589. svc := ec2.New(sess)
  1590. params := &ec2.DeletePlacementGroupInput{
  1591. GroupName: aws.String("String"), // Required
  1592. DryRun: aws.Bool(true),
  1593. }
  1594. resp, err := svc.DeletePlacementGroup(params)
  1595. if err != nil {
  1596. // Print the error, cast err to awserr.Error to get the Code and
  1597. // Message from an error.
  1598. fmt.Println(err.Error())
  1599. return
  1600. }
  1601. // Pretty-print the response data.
  1602. fmt.Println(resp)
  1603. }
  1604. func ExampleEC2_DeleteRoute() {
  1605. sess, err := session.NewSession()
  1606. if err != nil {
  1607. fmt.Println("failed to create session,", err)
  1608. return
  1609. }
  1610. svc := ec2.New(sess)
  1611. params := &ec2.DeleteRouteInput{
  1612. DestinationCidrBlock: aws.String("String"), // Required
  1613. RouteTableId: aws.String("String"), // Required
  1614. DryRun: aws.Bool(true),
  1615. }
  1616. resp, err := svc.DeleteRoute(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_DeleteRouteTable() {
  1627. sess, err := session.NewSession()
  1628. if err != nil {
  1629. fmt.Println("failed to create session,", err)
  1630. return
  1631. }
  1632. svc := ec2.New(sess)
  1633. params := &ec2.DeleteRouteTableInput{
  1634. RouteTableId: aws.String("String"), // Required
  1635. DryRun: aws.Bool(true),
  1636. }
  1637. resp, err := svc.DeleteRouteTable(params)
  1638. if err != nil {
  1639. // Print the error, cast err to awserr.Error to get the Code and
  1640. // Message from an error.
  1641. fmt.Println(err.Error())
  1642. return
  1643. }
  1644. // Pretty-print the response data.
  1645. fmt.Println(resp)
  1646. }
  1647. func ExampleEC2_DeleteSecurityGroup() {
  1648. sess, err := session.NewSession()
  1649. if err != nil {
  1650. fmt.Println("failed to create session,", err)
  1651. return
  1652. }
  1653. svc := ec2.New(sess)
  1654. params := &ec2.DeleteSecurityGroupInput{
  1655. DryRun: aws.Bool(true),
  1656. GroupId: aws.String("String"),
  1657. GroupName: aws.String("String"),
  1658. }
  1659. resp, err := svc.DeleteSecurityGroup(params)
  1660. if err != nil {
  1661. // Print the error, cast err to awserr.Error to get the Code and
  1662. // Message from an error.
  1663. fmt.Println(err.Error())
  1664. return
  1665. }
  1666. // Pretty-print the response data.
  1667. fmt.Println(resp)
  1668. }
  1669. func ExampleEC2_DeleteSnapshot() {
  1670. sess, err := session.NewSession()
  1671. if err != nil {
  1672. fmt.Println("failed to create session,", err)
  1673. return
  1674. }
  1675. svc := ec2.New(sess)
  1676. params := &ec2.DeleteSnapshotInput{
  1677. SnapshotId: aws.String("String"), // Required
  1678. DryRun: aws.Bool(true),
  1679. }
  1680. resp, err := svc.DeleteSnapshot(params)
  1681. if err != nil {
  1682. // Print the error, cast err to awserr.Error to get the Code and
  1683. // Message from an error.
  1684. fmt.Println(err.Error())
  1685. return
  1686. }
  1687. // Pretty-print the response data.
  1688. fmt.Println(resp)
  1689. }
  1690. func ExampleEC2_DeleteSpotDatafeedSubscription() {
  1691. sess, err := session.NewSession()
  1692. if err != nil {
  1693. fmt.Println("failed to create session,", err)
  1694. return
  1695. }
  1696. svc := ec2.New(sess)
  1697. params := &ec2.DeleteSpotDatafeedSubscriptionInput{
  1698. DryRun: aws.Bool(true),
  1699. }
  1700. resp, err := svc.DeleteSpotDatafeedSubscription(params)
  1701. if err != nil {
  1702. // Print the error, cast err to awserr.Error to get the Code and
  1703. // Message from an error.
  1704. fmt.Println(err.Error())
  1705. return
  1706. }
  1707. // Pretty-print the response data.
  1708. fmt.Println(resp)
  1709. }
  1710. func ExampleEC2_DeleteSubnet() {
  1711. sess, err := session.NewSession()
  1712. if err != nil {
  1713. fmt.Println("failed to create session,", err)
  1714. return
  1715. }
  1716. svc := ec2.New(sess)
  1717. params := &ec2.DeleteSubnetInput{
  1718. SubnetId: aws.String("String"), // Required
  1719. DryRun: aws.Bool(true),
  1720. }
  1721. resp, err := svc.DeleteSubnet(params)
  1722. if err != nil {
  1723. // Print the error, cast err to awserr.Error to get the Code and
  1724. // Message from an error.
  1725. fmt.Println(err.Error())
  1726. return
  1727. }
  1728. // Pretty-print the response data.
  1729. fmt.Println(resp)
  1730. }
  1731. func ExampleEC2_DeleteTags() {
  1732. sess, err := session.NewSession()
  1733. if err != nil {
  1734. fmt.Println("failed to create session,", err)
  1735. return
  1736. }
  1737. svc := ec2.New(sess)
  1738. params := &ec2.DeleteTagsInput{
  1739. Resources: []*string{ // Required
  1740. aws.String("String"), // Required
  1741. // More values...
  1742. },
  1743. DryRun: aws.Bool(true),
  1744. Tags: []*ec2.Tag{
  1745. { // Required
  1746. Key: aws.String("String"),
  1747. Value: aws.String("String"),
  1748. },
  1749. // More values...
  1750. },
  1751. }
  1752. resp, err := svc.DeleteTags(params)
  1753. if err != nil {
  1754. // Print the error, cast err to awserr.Error to get the Code and
  1755. // Message from an error.
  1756. fmt.Println(err.Error())
  1757. return
  1758. }
  1759. // Pretty-print the response data.
  1760. fmt.Println(resp)
  1761. }
  1762. func ExampleEC2_DeleteVolume() {
  1763. sess, err := session.NewSession()
  1764. if err != nil {
  1765. fmt.Println("failed to create session,", err)
  1766. return
  1767. }
  1768. svc := ec2.New(sess)
  1769. params := &ec2.DeleteVolumeInput{
  1770. VolumeId: aws.String("String"), // Required
  1771. DryRun: aws.Bool(true),
  1772. }
  1773. resp, err := svc.DeleteVolume(params)
  1774. if err != nil {
  1775. // Print the error, cast err to awserr.Error to get the Code and
  1776. // Message from an error.
  1777. fmt.Println(err.Error())
  1778. return
  1779. }
  1780. // Pretty-print the response data.
  1781. fmt.Println(resp)
  1782. }
  1783. func ExampleEC2_DeleteVpc() {
  1784. sess, err := session.NewSession()
  1785. if err != nil {
  1786. fmt.Println("failed to create session,", err)
  1787. return
  1788. }
  1789. svc := ec2.New(sess)
  1790. params := &ec2.DeleteVpcInput{
  1791. VpcId: aws.String("String"), // Required
  1792. DryRun: aws.Bool(true),
  1793. }
  1794. resp, err := svc.DeleteVpc(params)
  1795. if err != nil {
  1796. // Print the error, cast err to awserr.Error to get the Code and
  1797. // Message from an error.
  1798. fmt.Println(err.Error())
  1799. return
  1800. }
  1801. // Pretty-print the response data.
  1802. fmt.Println(resp)
  1803. }
  1804. func ExampleEC2_DeleteVpcEndpoints() {
  1805. sess, err := session.NewSession()
  1806. if err != nil {
  1807. fmt.Println("failed to create session,", err)
  1808. return
  1809. }
  1810. svc := ec2.New(sess)
  1811. params := &ec2.DeleteVpcEndpointsInput{
  1812. VpcEndpointIds: []*string{ // Required
  1813. aws.String("String"), // Required
  1814. // More values...
  1815. },
  1816. DryRun: aws.Bool(true),
  1817. }
  1818. resp, err := svc.DeleteVpcEndpoints(params)
  1819. if err != nil {
  1820. // Print the error, cast err to awserr.Error to get the Code and
  1821. // Message from an error.
  1822. fmt.Println(err.Error())
  1823. return
  1824. }
  1825. // Pretty-print the response data.
  1826. fmt.Println(resp)
  1827. }
  1828. func ExampleEC2_DeleteVpcPeeringConnection() {
  1829. sess, err := session.NewSession()
  1830. if err != nil {
  1831. fmt.Println("failed to create session,", err)
  1832. return
  1833. }
  1834. svc := ec2.New(sess)
  1835. params := &ec2.DeleteVpcPeeringConnectionInput{
  1836. VpcPeeringConnectionId: aws.String("String"), // Required
  1837. DryRun: aws.Bool(true),
  1838. }
  1839. resp, err := svc.DeleteVpcPeeringConnection(params)
  1840. if err != nil {
  1841. // Print the error, cast err to awserr.Error to get the Code and
  1842. // Message from an error.
  1843. fmt.Println(err.Error())
  1844. return
  1845. }
  1846. // Pretty-print the response data.
  1847. fmt.Println(resp)
  1848. }
  1849. func ExampleEC2_DeleteVpnConnection() {
  1850. sess, err := session.NewSession()
  1851. if err != nil {
  1852. fmt.Println("failed to create session,", err)
  1853. return
  1854. }
  1855. svc := ec2.New(sess)
  1856. params := &ec2.DeleteVpnConnectionInput{
  1857. VpnConnectionId: aws.String("String"), // Required
  1858. DryRun: aws.Bool(true),
  1859. }
  1860. resp, err := svc.DeleteVpnConnection(params)
  1861. if err != nil {
  1862. // Print the error, cast err to awserr.Error to get the Code and
  1863. // Message from an error.
  1864. fmt.Println(err.Error())
  1865. return
  1866. }
  1867. // Pretty-print the response data.
  1868. fmt.Println(resp)
  1869. }
  1870. func ExampleEC2_DeleteVpnConnectionRoute() {
  1871. sess, err := session.NewSession()
  1872. if err != nil {
  1873. fmt.Println("failed to create session,", err)
  1874. return
  1875. }
  1876. svc := ec2.New(sess)
  1877. params := &ec2.DeleteVpnConnectionRouteInput{
  1878. DestinationCidrBlock: aws.String("String"), // Required
  1879. VpnConnectionId: aws.String("String"), // Required
  1880. }
  1881. resp, err := svc.DeleteVpnConnectionRoute(params)
  1882. if err != nil {
  1883. // Print the error, cast err to awserr.Error to get the Code and
  1884. // Message from an error.
  1885. fmt.Println(err.Error())
  1886. return
  1887. }
  1888. // Pretty-print the response data.
  1889. fmt.Println(resp)
  1890. }
  1891. func ExampleEC2_DeleteVpnGateway() {
  1892. sess, err := session.NewSession()
  1893. if err != nil {
  1894. fmt.Println("failed to create session,", err)
  1895. return
  1896. }
  1897. svc := ec2.New(sess)
  1898. params := &ec2.DeleteVpnGatewayInput{
  1899. VpnGatewayId: aws.String("String"), // Required
  1900. DryRun: aws.Bool(true),
  1901. }
  1902. resp, err := svc.DeleteVpnGateway(params)
  1903. if err != nil {
  1904. // Print the error, cast err to awserr.Error to get the Code and
  1905. // Message from an error.
  1906. fmt.Println(err.Error())
  1907. return
  1908. }
  1909. // Pretty-print the response data.
  1910. fmt.Println(resp)
  1911. }
  1912. func ExampleEC2_DeregisterImage() {
  1913. sess, err := session.NewSession()
  1914. if err != nil {
  1915. fmt.Println("failed to create session,", err)
  1916. return
  1917. }
  1918. svc := ec2.New(sess)
  1919. params := &ec2.DeregisterImageInput{
  1920. ImageId: aws.String("String"), // Required
  1921. DryRun: aws.Bool(true),
  1922. }
  1923. resp, err := svc.DeregisterImage(params)
  1924. if err != nil {
  1925. // Print the error, cast err to awserr.Error to get the Code and
  1926. // Message from an error.
  1927. fmt.Println(err.Error())
  1928. return
  1929. }
  1930. // Pretty-print the response data.
  1931. fmt.Println(resp)
  1932. }
  1933. func ExampleEC2_DescribeAccountAttributes() {
  1934. sess, err := session.NewSession()
  1935. if err != nil {
  1936. fmt.Println("failed to create session,", err)
  1937. return
  1938. }
  1939. svc := ec2.New(sess)
  1940. params := &ec2.DescribeAccountAttributesInput{
  1941. AttributeNames: []*string{
  1942. aws.String("AccountAttributeName"), // Required
  1943. // More values...
  1944. },
  1945. DryRun: aws.Bool(true),
  1946. }
  1947. resp, err := svc.DescribeAccountAttributes(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_DescribeAddresses() {
  1958. sess, err := session.NewSession()
  1959. if err != nil {
  1960. fmt.Println("failed to create session,", err)
  1961. return
  1962. }
  1963. svc := ec2.New(sess)
  1964. params := &ec2.DescribeAddressesInput{
  1965. AllocationIds: []*string{
  1966. aws.String("String"), // Required
  1967. // More values...
  1968. },
  1969. DryRun: aws.Bool(true),
  1970. Filters: []*ec2.Filter{
  1971. { // Required
  1972. Name: aws.String("String"),
  1973. Values: []*string{
  1974. aws.String("String"), // Required
  1975. // More values...
  1976. },
  1977. },
  1978. // More values...
  1979. },
  1980. PublicIps: []*string{
  1981. aws.String("String"), // Required
  1982. // More values...
  1983. },
  1984. }
  1985. resp, err := svc.DescribeAddresses(params)
  1986. if err != nil {
  1987. // Print the error, cast err to awserr.Error to get the Code and
  1988. // Message from an error.
  1989. fmt.Println(err.Error())
  1990. return
  1991. }
  1992. // Pretty-print the response data.
  1993. fmt.Println(resp)
  1994. }
  1995. func ExampleEC2_DescribeAvailabilityZones() {
  1996. sess, err := session.NewSession()
  1997. if err != nil {
  1998. fmt.Println("failed to create session,", err)
  1999. return
  2000. }
  2001. svc := ec2.New(sess)
  2002. params := &ec2.DescribeAvailabilityZonesInput{
  2003. DryRun: aws.Bool(true),
  2004. Filters: []*ec2.Filter{
  2005. { // Required
  2006. Name: aws.String("String"),
  2007. Values: []*string{
  2008. aws.String("String"), // Required
  2009. // More values...
  2010. },
  2011. },
  2012. // More values...
  2013. },
  2014. ZoneNames: []*string{
  2015. aws.String("String"), // Required
  2016. // More values...
  2017. },
  2018. }
  2019. resp, err := svc.DescribeAvailabilityZones(params)
  2020. if err != nil {
  2021. // Print the error, cast err to awserr.Error to get the Code and
  2022. // Message from an error.
  2023. fmt.Println(err.Error())
  2024. return
  2025. }
  2026. // Pretty-print the response data.
  2027. fmt.Println(resp)
  2028. }
  2029. func ExampleEC2_DescribeBundleTasks() {
  2030. sess, err := session.NewSession()
  2031. if err != nil {
  2032. fmt.Println("failed to create session,", err)
  2033. return
  2034. }
  2035. svc := ec2.New(sess)
  2036. params := &ec2.DescribeBundleTasksInput{
  2037. BundleIds: []*string{
  2038. aws.String("String"), // Required
  2039. // More values...
  2040. },
  2041. DryRun: aws.Bool(true),
  2042. Filters: []*ec2.Filter{
  2043. { // Required
  2044. Name: aws.String("String"),
  2045. Values: []*string{
  2046. aws.String("String"), // Required
  2047. // More values...
  2048. },
  2049. },
  2050. // More values...
  2051. },
  2052. }
  2053. resp, err := svc.DescribeBundleTasks(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_DescribeClassicLinkInstances() {
  2064. sess, err := session.NewSession()
  2065. if err != nil {
  2066. fmt.Println("failed to create session,", err)
  2067. return
  2068. }
  2069. svc := ec2.New(sess)
  2070. params := &ec2.DescribeClassicLinkInstancesInput{
  2071. DryRun: aws.Bool(true),
  2072. Filters: []*ec2.Filter{
  2073. { // Required
  2074. Name: aws.String("String"),
  2075. Values: []*string{
  2076. aws.String("String"), // Required
  2077. // More values...
  2078. },
  2079. },
  2080. // More values...
  2081. },
  2082. InstanceIds: []*string{
  2083. aws.String("String"), // Required
  2084. // More values...
  2085. },
  2086. MaxResults: aws.Int64(1),
  2087. NextToken: aws.String("String"),
  2088. }
  2089. resp, err := svc.DescribeClassicLinkInstances(params)
  2090. if err != nil {
  2091. // Print the error, cast err to awserr.Error to get the Code and
  2092. // Message from an error.
  2093. fmt.Println(err.Error())
  2094. return
  2095. }
  2096. // Pretty-print the response data.
  2097. fmt.Println(resp)
  2098. }
  2099. func ExampleEC2_DescribeConversionTasks() {
  2100. sess, err := session.NewSession()
  2101. if err != nil {
  2102. fmt.Println("failed to create session,", err)
  2103. return
  2104. }
  2105. svc := ec2.New(sess)
  2106. params := &ec2.DescribeConversionTasksInput{
  2107. ConversionTaskIds: []*string{
  2108. aws.String("String"), // Required
  2109. // More values...
  2110. },
  2111. DryRun: aws.Bool(true),
  2112. }
  2113. resp, err := svc.DescribeConversionTasks(params)
  2114. if err != nil {
  2115. // Print the error, cast err to awserr.Error to get the Code and
  2116. // Message from an error.
  2117. fmt.Println(err.Error())
  2118. return
  2119. }
  2120. // Pretty-print the response data.
  2121. fmt.Println(resp)
  2122. }
  2123. func ExampleEC2_DescribeCustomerGateways() {
  2124. sess, err := session.NewSession()
  2125. if err != nil {
  2126. fmt.Println("failed to create session,", err)
  2127. return
  2128. }
  2129. svc := ec2.New(sess)
  2130. params := &ec2.DescribeCustomerGatewaysInput{
  2131. CustomerGatewayIds: []*string{
  2132. aws.String("String"), // Required
  2133. // More values...
  2134. },
  2135. DryRun: aws.Bool(true),
  2136. Filters: []*ec2.Filter{
  2137. { // Required
  2138. Name: aws.String("String"),
  2139. Values: []*string{
  2140. aws.String("String"), // Required
  2141. // More values...
  2142. },
  2143. },
  2144. // More values...
  2145. },
  2146. }
  2147. resp, err := svc.DescribeCustomerGateways(params)
  2148. if err != nil {
  2149. // Print the error, cast err to awserr.Error to get the Code and
  2150. // Message from an error.
  2151. fmt.Println(err.Error())
  2152. return
  2153. }
  2154. // Pretty-print the response data.
  2155. fmt.Println(resp)
  2156. }
  2157. func ExampleEC2_DescribeDhcpOptions() {
  2158. sess, err := session.NewSession()
  2159. if err != nil {
  2160. fmt.Println("failed to create session,", err)
  2161. return
  2162. }
  2163. svc := ec2.New(sess)
  2164. params := &ec2.DescribeDhcpOptionsInput{
  2165. DhcpOptionsIds: []*string{
  2166. aws.String("String"), // Required
  2167. // More values...
  2168. },
  2169. DryRun: aws.Bool(true),
  2170. Filters: []*ec2.Filter{
  2171. { // Required
  2172. Name: aws.String("String"),
  2173. Values: []*string{
  2174. aws.String("String"), // Required
  2175. // More values...
  2176. },
  2177. },
  2178. // More values...
  2179. },
  2180. }
  2181. resp, err := svc.DescribeDhcpOptions(params)
  2182. if err != nil {
  2183. // Print the error, cast err to awserr.Error to get the Code and
  2184. // Message from an error.
  2185. fmt.Println(err.Error())
  2186. return
  2187. }
  2188. // Pretty-print the response data.
  2189. fmt.Println(resp)
  2190. }
  2191. func ExampleEC2_DescribeExportTasks() {
  2192. sess, err := session.NewSession()
  2193. if err != nil {
  2194. fmt.Println("failed to create session,", err)
  2195. return
  2196. }
  2197. svc := ec2.New(sess)
  2198. params := &ec2.DescribeExportTasksInput{
  2199. ExportTaskIds: []*string{
  2200. aws.String("String"), // Required
  2201. // More values...
  2202. },
  2203. }
  2204. resp, err := svc.DescribeExportTasks(params)
  2205. if err != nil {
  2206. // Print the error, cast err to awserr.Error to get the Code and
  2207. // Message from an error.
  2208. fmt.Println(err.Error())
  2209. return
  2210. }
  2211. // Pretty-print the response data.
  2212. fmt.Println(resp)
  2213. }
  2214. func ExampleEC2_DescribeFlowLogs() {
  2215. sess, err := session.NewSession()
  2216. if err != nil {
  2217. fmt.Println("failed to create session,", err)
  2218. return
  2219. }
  2220. svc := ec2.New(sess)
  2221. params := &ec2.DescribeFlowLogsInput{
  2222. Filter: []*ec2.Filter{
  2223. { // Required
  2224. Name: aws.String("String"),
  2225. Values: []*string{
  2226. aws.String("String"), // Required
  2227. // More values...
  2228. },
  2229. },
  2230. // More values...
  2231. },
  2232. FlowLogIds: []*string{
  2233. aws.String("String"), // Required
  2234. // More values...
  2235. },
  2236. MaxResults: aws.Int64(1),
  2237. NextToken: aws.String("String"),
  2238. }
  2239. resp, err := svc.DescribeFlowLogs(params)
  2240. if err != nil {
  2241. // Print the error, cast err to awserr.Error to get the Code and
  2242. // Message from an error.
  2243. fmt.Println(err.Error())
  2244. return
  2245. }
  2246. // Pretty-print the response data.
  2247. fmt.Println(resp)
  2248. }
  2249. func ExampleEC2_DescribeHostReservationOfferings() {
  2250. sess, err := session.NewSession()
  2251. if err != nil {
  2252. fmt.Println("failed to create session,", err)
  2253. return
  2254. }
  2255. svc := ec2.New(sess)
  2256. params := &ec2.DescribeHostReservationOfferingsInput{
  2257. Filter: []*ec2.Filter{
  2258. { // Required
  2259. Name: aws.String("String"),
  2260. Values: []*string{
  2261. aws.String("String"), // Required
  2262. // More values...
  2263. },
  2264. },
  2265. // More values...
  2266. },
  2267. MaxDuration: aws.Int64(1),
  2268. MaxResults: aws.Int64(1),
  2269. MinDuration: aws.Int64(1),
  2270. NextToken: aws.String("String"),
  2271. OfferingId: aws.String("String"),
  2272. }
  2273. resp, err := svc.DescribeHostReservationOfferings(params)
  2274. if err != nil {
  2275. // Print the error, cast err to awserr.Error to get the Code and
  2276. // Message from an error.
  2277. fmt.Println(err.Error())
  2278. return
  2279. }
  2280. // Pretty-print the response data.
  2281. fmt.Println(resp)
  2282. }
  2283. func ExampleEC2_DescribeHostReservations() {
  2284. sess, err := session.NewSession()
  2285. if err != nil {
  2286. fmt.Println("failed to create session,", err)
  2287. return
  2288. }
  2289. svc := ec2.New(sess)
  2290. params := &ec2.DescribeHostReservationsInput{
  2291. Filter: []*ec2.Filter{
  2292. { // Required
  2293. Name: aws.String("String"),
  2294. Values: []*string{
  2295. aws.String("String"), // Required
  2296. // More values...
  2297. },
  2298. },
  2299. // More values...
  2300. },
  2301. HostReservationIdSet: []*string{
  2302. aws.String("String"), // Required
  2303. // More values...
  2304. },
  2305. MaxResults: aws.Int64(1),
  2306. NextToken: aws.String("String"),
  2307. }
  2308. resp, err := svc.DescribeHostReservations(params)
  2309. if err != nil {
  2310. // Print the error, cast err to awserr.Error to get the Code and
  2311. // Message from an error.
  2312. fmt.Println(err.Error())
  2313. return
  2314. }
  2315. // Pretty-print the response data.
  2316. fmt.Println(resp)
  2317. }
  2318. func ExampleEC2_DescribeHosts() {
  2319. sess, err := session.NewSession()
  2320. if err != nil {
  2321. fmt.Println("failed to create session,", err)
  2322. return
  2323. }
  2324. svc := ec2.New(sess)
  2325. params := &ec2.DescribeHostsInput{
  2326. Filter: []*ec2.Filter{
  2327. { // Required
  2328. Name: aws.String("String"),
  2329. Values: []*string{
  2330. aws.String("String"), // Required
  2331. // More values...
  2332. },
  2333. },
  2334. // More values...
  2335. },
  2336. HostIds: []*string{
  2337. aws.String("String"), // Required
  2338. // More values...
  2339. },
  2340. MaxResults: aws.Int64(1),
  2341. NextToken: aws.String("String"),
  2342. }
  2343. resp, err := svc.DescribeHosts(params)
  2344. if err != nil {
  2345. // Print the error, cast err to awserr.Error to get the Code and
  2346. // Message from an error.
  2347. fmt.Println(err.Error())
  2348. return
  2349. }
  2350. // Pretty-print the response data.
  2351. fmt.Println(resp)
  2352. }
  2353. func ExampleEC2_DescribeIdFormat() {
  2354. sess, err := session.NewSession()
  2355. if err != nil {
  2356. fmt.Println("failed to create session,", err)
  2357. return
  2358. }
  2359. svc := ec2.New(sess)
  2360. params := &ec2.DescribeIdFormatInput{
  2361. Resource: aws.String("String"),
  2362. }
  2363. resp, err := svc.DescribeIdFormat(params)
  2364. if err != nil {
  2365. // Print the error, cast err to awserr.Error to get the Code and
  2366. // Message from an error.
  2367. fmt.Println(err.Error())
  2368. return
  2369. }
  2370. // Pretty-print the response data.
  2371. fmt.Println(resp)
  2372. }
  2373. func ExampleEC2_DescribeIdentityIdFormat() {
  2374. sess, err := session.NewSession()
  2375. if err != nil {
  2376. fmt.Println("failed to create session,", err)
  2377. return
  2378. }
  2379. svc := ec2.New(sess)
  2380. params := &ec2.DescribeIdentityIdFormatInput{
  2381. PrincipalArn: aws.String("String"), // Required
  2382. Resource: aws.String("String"),
  2383. }
  2384. resp, err := svc.DescribeIdentityIdFormat(params)
  2385. if err != nil {
  2386. // Print the error, cast err to awserr.Error to get the Code and
  2387. // Message from an error.
  2388. fmt.Println(err.Error())
  2389. return
  2390. }
  2391. // Pretty-print the response data.
  2392. fmt.Println(resp)
  2393. }
  2394. func ExampleEC2_DescribeImageAttribute() {
  2395. sess, err := session.NewSession()
  2396. if err != nil {
  2397. fmt.Println("failed to create session,", err)
  2398. return
  2399. }
  2400. svc := ec2.New(sess)
  2401. params := &ec2.DescribeImageAttributeInput{
  2402. Attribute: aws.String("ImageAttributeName"), // Required
  2403. ImageId: aws.String("String"), // Required
  2404. DryRun: aws.Bool(true),
  2405. }
  2406. resp, err := svc.DescribeImageAttribute(params)
  2407. if err != nil {
  2408. // Print the error, cast err to awserr.Error to get the Code and
  2409. // Message from an error.
  2410. fmt.Println(err.Error())
  2411. return
  2412. }
  2413. // Pretty-print the response data.
  2414. fmt.Println(resp)
  2415. }
  2416. func ExampleEC2_DescribeImages() {
  2417. sess, err := session.NewSession()
  2418. if err != nil {
  2419. fmt.Println("failed to create session,", err)
  2420. return
  2421. }
  2422. svc := ec2.New(sess)
  2423. params := &ec2.DescribeImagesInput{
  2424. DryRun: aws.Bool(true),
  2425. ExecutableUsers: []*string{
  2426. aws.String("String"), // Required
  2427. // More values...
  2428. },
  2429. Filters: []*ec2.Filter{
  2430. { // Required
  2431. Name: aws.String("String"),
  2432. Values: []*string{
  2433. aws.String("String"), // Required
  2434. // More values...
  2435. },
  2436. },
  2437. // More values...
  2438. },
  2439. ImageIds: []*string{
  2440. aws.String("String"), // Required
  2441. // More values...
  2442. },
  2443. Owners: []*string{
  2444. aws.String("String"), // Required
  2445. // More values...
  2446. },
  2447. }
  2448. resp, err := svc.DescribeImages(params)
  2449. if err != nil {
  2450. // Print the error, cast err to awserr.Error to get the Code and
  2451. // Message from an error.
  2452. fmt.Println(err.Error())
  2453. return
  2454. }
  2455. // Pretty-print the response data.
  2456. fmt.Println(resp)
  2457. }
  2458. func ExampleEC2_DescribeImportImageTasks() {
  2459. sess, err := session.NewSession()
  2460. if err != nil {
  2461. fmt.Println("failed to create session,", err)
  2462. return
  2463. }
  2464. svc := ec2.New(sess)
  2465. params := &ec2.DescribeImportImageTasksInput{
  2466. DryRun: aws.Bool(true),
  2467. Filters: []*ec2.Filter{
  2468. { // Required
  2469. Name: aws.String("String"),
  2470. Values: []*string{
  2471. aws.String("String"), // Required
  2472. // More values...
  2473. },
  2474. },
  2475. // More values...
  2476. },
  2477. ImportTaskIds: []*string{
  2478. aws.String("String"), // Required
  2479. // More values...
  2480. },
  2481. MaxResults: aws.Int64(1),
  2482. NextToken: aws.String("String"),
  2483. }
  2484. resp, err := svc.DescribeImportImageTasks(params)
  2485. if err != nil {
  2486. // Print the error, cast err to awserr.Error to get the Code and
  2487. // Message from an error.
  2488. fmt.Println(err.Error())
  2489. return
  2490. }
  2491. // Pretty-print the response data.
  2492. fmt.Println(resp)
  2493. }
  2494. func ExampleEC2_DescribeImportSnapshotTasks() {
  2495. sess, err := session.NewSession()
  2496. if err != nil {
  2497. fmt.Println("failed to create session,", err)
  2498. return
  2499. }
  2500. svc := ec2.New(sess)
  2501. params := &ec2.DescribeImportSnapshotTasksInput{
  2502. DryRun: aws.Bool(true),
  2503. Filters: []*ec2.Filter{
  2504. { // Required
  2505. Name: aws.String("String"),
  2506. Values: []*string{
  2507. aws.String("String"), // Required
  2508. // More values...
  2509. },
  2510. },
  2511. // More values...
  2512. },
  2513. ImportTaskIds: []*string{
  2514. aws.String("String"), // Required
  2515. // More values...
  2516. },
  2517. MaxResults: aws.Int64(1),
  2518. NextToken: aws.String("String"),
  2519. }
  2520. resp, err := svc.DescribeImportSnapshotTasks(params)
  2521. if err != nil {
  2522. // Print the error, cast err to awserr.Error to get the Code and
  2523. // Message from an error.
  2524. fmt.Println(err.Error())
  2525. return
  2526. }
  2527. // Pretty-print the response data.
  2528. fmt.Println(resp)
  2529. }
  2530. func ExampleEC2_DescribeInstanceAttribute() {
  2531. sess, err := session.NewSession()
  2532. if err != nil {
  2533. fmt.Println("failed to create session,", err)
  2534. return
  2535. }
  2536. svc := ec2.New(sess)
  2537. params := &ec2.DescribeInstanceAttributeInput{
  2538. Attribute: aws.String("InstanceAttributeName"), // Required
  2539. InstanceId: aws.String("String"), // Required
  2540. DryRun: aws.Bool(true),
  2541. }
  2542. resp, err := svc.DescribeInstanceAttribute(params)
  2543. if err != nil {
  2544. // Print the error, cast err to awserr.Error to get the Code and
  2545. // Message from an error.
  2546. fmt.Println(err.Error())
  2547. return
  2548. }
  2549. // Pretty-print the response data.
  2550. fmt.Println(resp)
  2551. }
  2552. func ExampleEC2_DescribeInstanceStatus() {
  2553. sess, err := session.NewSession()
  2554. if err != nil {
  2555. fmt.Println("failed to create session,", err)
  2556. return
  2557. }
  2558. svc := ec2.New(sess)
  2559. params := &ec2.DescribeInstanceStatusInput{
  2560. DryRun: aws.Bool(true),
  2561. Filters: []*ec2.Filter{
  2562. { // Required
  2563. Name: aws.String("String"),
  2564. Values: []*string{
  2565. aws.String("String"), // Required
  2566. // More values...
  2567. },
  2568. },
  2569. // More values...
  2570. },
  2571. IncludeAllInstances: aws.Bool(true),
  2572. InstanceIds: []*string{
  2573. aws.String("String"), // Required
  2574. // More values...
  2575. },
  2576. MaxResults: aws.Int64(1),
  2577. NextToken: aws.String("String"),
  2578. }
  2579. resp, err := svc.DescribeInstanceStatus(params)
  2580. if err != nil {
  2581. // Print the error, cast err to awserr.Error to get the Code and
  2582. // Message from an error.
  2583. fmt.Println(err.Error())
  2584. return
  2585. }
  2586. // Pretty-print the response data.
  2587. fmt.Println(resp)
  2588. }
  2589. func ExampleEC2_DescribeInstances() {
  2590. sess, err := session.NewSession()
  2591. if err != nil {
  2592. fmt.Println("failed to create session,", err)
  2593. return
  2594. }
  2595. svc := ec2.New(sess)
  2596. params := &ec2.DescribeInstancesInput{
  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. InstanceIds: []*string{
  2609. aws.String("String"), // Required
  2610. // More values...
  2611. },
  2612. MaxResults: aws.Int64(1),
  2613. NextToken: aws.String("String"),
  2614. }
  2615. resp, err := svc.DescribeInstances(params)
  2616. if err != nil {
  2617. // Print the error, cast err to awserr.Error to get the Code and
  2618. // Message from an error.
  2619. fmt.Println(err.Error())
  2620. return
  2621. }
  2622. // Pretty-print the response data.
  2623. fmt.Println(resp)
  2624. }
  2625. func ExampleEC2_DescribeInternetGateways() {
  2626. sess, err := session.NewSession()
  2627. if err != nil {
  2628. fmt.Println("failed to create session,", err)
  2629. return
  2630. }
  2631. svc := ec2.New(sess)
  2632. params := &ec2.DescribeInternetGatewaysInput{
  2633. DryRun: aws.Bool(true),
  2634. Filters: []*ec2.Filter{
  2635. { // Required
  2636. Name: aws.String("String"),
  2637. Values: []*string{
  2638. aws.String("String"), // Required
  2639. // More values...
  2640. },
  2641. },
  2642. // More values...
  2643. },
  2644. InternetGatewayIds: []*string{
  2645. aws.String("String"), // Required
  2646. // More values...
  2647. },
  2648. }
  2649. resp, err := svc.DescribeInternetGateways(params)
  2650. if err != nil {
  2651. // Print the error, cast err to awserr.Error to get the Code and
  2652. // Message from an error.
  2653. fmt.Println(err.Error())
  2654. return
  2655. }
  2656. // Pretty-print the response data.
  2657. fmt.Println(resp)
  2658. }
  2659. func ExampleEC2_DescribeKeyPairs() {
  2660. sess, err := session.NewSession()
  2661. if err != nil {
  2662. fmt.Println("failed to create session,", err)
  2663. return
  2664. }
  2665. svc := ec2.New(sess)
  2666. params := &ec2.DescribeKeyPairsInput{
  2667. DryRun: aws.Bool(true),
  2668. Filters: []*ec2.Filter{
  2669. { // Required
  2670. Name: aws.String("String"),
  2671. Values: []*string{
  2672. aws.String("String"), // Required
  2673. // More values...
  2674. },
  2675. },
  2676. // More values...
  2677. },
  2678. KeyNames: []*string{
  2679. aws.String("String"), // Required
  2680. // More values...
  2681. },
  2682. }
  2683. resp, err := svc.DescribeKeyPairs(params)
  2684. if err != nil {
  2685. // Print the error, cast err to awserr.Error to get the Code and
  2686. // Message from an error.
  2687. fmt.Println(err.Error())
  2688. return
  2689. }
  2690. // Pretty-print the response data.
  2691. fmt.Println(resp)
  2692. }
  2693. func ExampleEC2_DescribeMovingAddresses() {
  2694. sess, err := session.NewSession()
  2695. if err != nil {
  2696. fmt.Println("failed to create session,", err)
  2697. return
  2698. }
  2699. svc := ec2.New(sess)
  2700. params := &ec2.DescribeMovingAddressesInput{
  2701. DryRun: aws.Bool(true),
  2702. Filters: []*ec2.Filter{
  2703. { // Required
  2704. Name: aws.String("String"),
  2705. Values: []*string{
  2706. aws.String("String"), // Required
  2707. // More values...
  2708. },
  2709. },
  2710. // More values...
  2711. },
  2712. MaxResults: aws.Int64(1),
  2713. NextToken: aws.String("String"),
  2714. PublicIps: []*string{
  2715. aws.String("String"), // Required
  2716. // More values...
  2717. },
  2718. }
  2719. resp, err := svc.DescribeMovingAddresses(params)
  2720. if err != nil {
  2721. // Print the error, cast err to awserr.Error to get the Code and
  2722. // Message from an error.
  2723. fmt.Println(err.Error())
  2724. return
  2725. }
  2726. // Pretty-print the response data.
  2727. fmt.Println(resp)
  2728. }
  2729. func ExampleEC2_DescribeNatGateways() {
  2730. sess, err := session.NewSession()
  2731. if err != nil {
  2732. fmt.Println("failed to create session,", err)
  2733. return
  2734. }
  2735. svc := ec2.New(sess)
  2736. params := &ec2.DescribeNatGatewaysInput{
  2737. Filter: []*ec2.Filter{
  2738. { // Required
  2739. Name: aws.String("String"),
  2740. Values: []*string{
  2741. aws.String("String"), // Required
  2742. // More values...
  2743. },
  2744. },
  2745. // More values...
  2746. },
  2747. MaxResults: aws.Int64(1),
  2748. NatGatewayIds: []*string{
  2749. aws.String("String"), // Required
  2750. // More values...
  2751. },
  2752. NextToken: aws.String("String"),
  2753. }
  2754. resp, err := svc.DescribeNatGateways(params)
  2755. if err != nil {
  2756. // Print the error, cast err to awserr.Error to get the Code and
  2757. // Message from an error.
  2758. fmt.Println(err.Error())
  2759. return
  2760. }
  2761. // Pretty-print the response data.
  2762. fmt.Println(resp)
  2763. }
  2764. func ExampleEC2_DescribeNetworkAcls() {
  2765. sess, err := session.NewSession()
  2766. if err != nil {
  2767. fmt.Println("failed to create session,", err)
  2768. return
  2769. }
  2770. svc := ec2.New(sess)
  2771. params := &ec2.DescribeNetworkAclsInput{
  2772. DryRun: aws.Bool(true),
  2773. Filters: []*ec2.Filter{
  2774. { // Required
  2775. Name: aws.String("String"),
  2776. Values: []*string{
  2777. aws.String("String"), // Required
  2778. // More values...
  2779. },
  2780. },
  2781. // More values...
  2782. },
  2783. NetworkAclIds: []*string{
  2784. aws.String("String"), // Required
  2785. // More values...
  2786. },
  2787. }
  2788. resp, err := svc.DescribeNetworkAcls(params)
  2789. if err != nil {
  2790. // Print the error, cast err to awserr.Error to get the Code and
  2791. // Message from an error.
  2792. fmt.Println(err.Error())
  2793. return
  2794. }
  2795. // Pretty-print the response data.
  2796. fmt.Println(resp)
  2797. }
  2798. func ExampleEC2_DescribeNetworkInterfaceAttribute() {
  2799. sess, err := session.NewSession()
  2800. if err != nil {
  2801. fmt.Println("failed to create session,", err)
  2802. return
  2803. }
  2804. svc := ec2.New(sess)
  2805. params := &ec2.DescribeNetworkInterfaceAttributeInput{
  2806. NetworkInterfaceId: aws.String("String"), // Required
  2807. Attribute: aws.String("NetworkInterfaceAttribute"),
  2808. DryRun: aws.Bool(true),
  2809. }
  2810. resp, err := svc.DescribeNetworkInterfaceAttribute(params)
  2811. if err != nil {
  2812. // Print the error, cast err to awserr.Error to get the Code and
  2813. // Message from an error.
  2814. fmt.Println(err.Error())
  2815. return
  2816. }
  2817. // Pretty-print the response data.
  2818. fmt.Println(resp)
  2819. }
  2820. func ExampleEC2_DescribeNetworkInterfaces() {
  2821. sess, err := session.NewSession()
  2822. if err != nil {
  2823. fmt.Println("failed to create session,", err)
  2824. return
  2825. }
  2826. svc := ec2.New(sess)
  2827. params := &ec2.DescribeNetworkInterfacesInput{
  2828. DryRun: aws.Bool(true),
  2829. Filters: []*ec2.Filter{
  2830. { // Required
  2831. Name: aws.String("String"),
  2832. Values: []*string{
  2833. aws.String("String"), // Required
  2834. // More values...
  2835. },
  2836. },
  2837. // More values...
  2838. },
  2839. NetworkInterfaceIds: []*string{
  2840. aws.String("String"), // Required
  2841. // More values...
  2842. },
  2843. }
  2844. resp, err := svc.DescribeNetworkInterfaces(params)
  2845. if err != nil {
  2846. // Print the error, cast err to awserr.Error to get the Code and
  2847. // Message from an error.
  2848. fmt.Println(err.Error())
  2849. return
  2850. }
  2851. // Pretty-print the response data.
  2852. fmt.Println(resp)
  2853. }
  2854. func ExampleEC2_DescribePlacementGroups() {
  2855. sess, err := session.NewSession()
  2856. if err != nil {
  2857. fmt.Println("failed to create session,", err)
  2858. return
  2859. }
  2860. svc := ec2.New(sess)
  2861. params := &ec2.DescribePlacementGroupsInput{
  2862. DryRun: aws.Bool(true),
  2863. Filters: []*ec2.Filter{
  2864. { // Required
  2865. Name: aws.String("String"),
  2866. Values: []*string{
  2867. aws.String("String"), // Required
  2868. // More values...
  2869. },
  2870. },
  2871. // More values...
  2872. },
  2873. GroupNames: []*string{
  2874. aws.String("String"), // Required
  2875. // More values...
  2876. },
  2877. }
  2878. resp, err := svc.DescribePlacementGroups(params)
  2879. if err != nil {
  2880. // Print the error, cast err to awserr.Error to get the Code and
  2881. // Message from an error.
  2882. fmt.Println(err.Error())
  2883. return
  2884. }
  2885. // Pretty-print the response data.
  2886. fmt.Println(resp)
  2887. }
  2888. func ExampleEC2_DescribePrefixLists() {
  2889. sess, err := session.NewSession()
  2890. if err != nil {
  2891. fmt.Println("failed to create session,", err)
  2892. return
  2893. }
  2894. svc := ec2.New(sess)
  2895. params := &ec2.DescribePrefixListsInput{
  2896. DryRun: aws.Bool(true),
  2897. Filters: []*ec2.Filter{
  2898. { // Required
  2899. Name: aws.String("String"),
  2900. Values: []*string{
  2901. aws.String("String"), // Required
  2902. // More values...
  2903. },
  2904. },
  2905. // More values...
  2906. },
  2907. MaxResults: aws.Int64(1),
  2908. NextToken: aws.String("String"),
  2909. PrefixListIds: []*string{
  2910. aws.String("String"), // Required
  2911. // More values...
  2912. },
  2913. }
  2914. resp, err := svc.DescribePrefixLists(params)
  2915. if err != nil {
  2916. // Print the error, cast err to awserr.Error to get the Code and
  2917. // Message from an error.
  2918. fmt.Println(err.Error())
  2919. return
  2920. }
  2921. // Pretty-print the response data.
  2922. fmt.Println(resp)
  2923. }
  2924. func ExampleEC2_DescribeRegions() {
  2925. sess, err := session.NewSession()
  2926. if err != nil {
  2927. fmt.Println("failed to create session,", err)
  2928. return
  2929. }
  2930. svc := ec2.New(sess)
  2931. params := &ec2.DescribeRegionsInput{
  2932. DryRun: aws.Bool(true),
  2933. Filters: []*ec2.Filter{
  2934. { // Required
  2935. Name: aws.String("String"),
  2936. Values: []*string{
  2937. aws.String("String"), // Required
  2938. // More values...
  2939. },
  2940. },
  2941. // More values...
  2942. },
  2943. RegionNames: []*string{
  2944. aws.String("String"), // Required
  2945. // More values...
  2946. },
  2947. }
  2948. resp, err := svc.DescribeRegions(params)
  2949. if err != nil {
  2950. // Print the error, cast err to awserr.Error to get the Code and
  2951. // Message from an error.
  2952. fmt.Println(err.Error())
  2953. return
  2954. }
  2955. // Pretty-print the response data.
  2956. fmt.Println(resp)
  2957. }
  2958. func ExampleEC2_DescribeReservedInstances() {
  2959. sess, err := session.NewSession()
  2960. if err != nil {
  2961. fmt.Println("failed to create session,", err)
  2962. return
  2963. }
  2964. svc := ec2.New(sess)
  2965. params := &ec2.DescribeReservedInstancesInput{
  2966. DryRun: aws.Bool(true),
  2967. Filters: []*ec2.Filter{
  2968. { // Required
  2969. Name: aws.String("String"),
  2970. Values: []*string{
  2971. aws.String("String"), // Required
  2972. // More values...
  2973. },
  2974. },
  2975. // More values...
  2976. },
  2977. OfferingClass: aws.String("OfferingClassType"),
  2978. OfferingType: aws.String("OfferingTypeValues"),
  2979. ReservedInstancesIds: []*string{
  2980. aws.String("String"), // Required
  2981. // More values...
  2982. },
  2983. }
  2984. resp, err := svc.DescribeReservedInstances(params)
  2985. if err != nil {
  2986. // Print the error, cast err to awserr.Error to get the Code and
  2987. // Message from an error.
  2988. fmt.Println(err.Error())
  2989. return
  2990. }
  2991. // Pretty-print the response data.
  2992. fmt.Println(resp)
  2993. }
  2994. func ExampleEC2_DescribeReservedInstancesListings() {
  2995. sess, err := session.NewSession()
  2996. if err != nil {
  2997. fmt.Println("failed to create session,", err)
  2998. return
  2999. }
  3000. svc := ec2.New(sess)
  3001. params := &ec2.DescribeReservedInstancesListingsInput{
  3002. Filters: []*ec2.Filter{
  3003. { // Required
  3004. Name: aws.String("String"),
  3005. Values: []*string{
  3006. aws.String("String"), // Required
  3007. // More values...
  3008. },
  3009. },
  3010. // More values...
  3011. },
  3012. ReservedInstancesId: aws.String("String"),
  3013. ReservedInstancesListingId: aws.String("String"),
  3014. }
  3015. resp, err := svc.DescribeReservedInstancesListings(params)
  3016. if err != nil {
  3017. // Print the error, cast err to awserr.Error to get the Code and
  3018. // Message from an error.
  3019. fmt.Println(err.Error())
  3020. return
  3021. }
  3022. // Pretty-print the response data.
  3023. fmt.Println(resp)
  3024. }
  3025. func ExampleEC2_DescribeReservedInstancesModifications() {
  3026. sess, err := session.NewSession()
  3027. if err != nil {
  3028. fmt.Println("failed to create session,", err)
  3029. return
  3030. }
  3031. svc := ec2.New(sess)
  3032. params := &ec2.DescribeReservedInstancesModificationsInput{
  3033. Filters: []*ec2.Filter{
  3034. { // Required
  3035. Name: aws.String("String"),
  3036. Values: []*string{
  3037. aws.String("String"), // Required
  3038. // More values...
  3039. },
  3040. },
  3041. // More values...
  3042. },
  3043. NextToken: aws.String("String"),
  3044. ReservedInstancesModificationIds: []*string{
  3045. aws.String("String"), // Required
  3046. // More values...
  3047. },
  3048. }
  3049. resp, err := svc.DescribeReservedInstancesModifications(params)
  3050. if err != nil {
  3051. // Print the error, cast err to awserr.Error to get the Code and
  3052. // Message from an error.
  3053. fmt.Println(err.Error())
  3054. return
  3055. }
  3056. // Pretty-print the response data.
  3057. fmt.Println(resp)
  3058. }
  3059. func ExampleEC2_DescribeReservedInstancesOfferings() {
  3060. sess, err := session.NewSession()
  3061. if err != nil {
  3062. fmt.Println("failed to create session,", err)
  3063. return
  3064. }
  3065. svc := ec2.New(sess)
  3066. params := &ec2.DescribeReservedInstancesOfferingsInput{
  3067. AvailabilityZone: aws.String("String"),
  3068. DryRun: aws.Bool(true),
  3069. Filters: []*ec2.Filter{
  3070. { // Required
  3071. Name: aws.String("String"),
  3072. Values: []*string{
  3073. aws.String("String"), // Required
  3074. // More values...
  3075. },
  3076. },
  3077. // More values...
  3078. },
  3079. IncludeMarketplace: aws.Bool(true),
  3080. InstanceTenancy: aws.String("Tenancy"),
  3081. InstanceType: aws.String("InstanceType"),
  3082. MaxDuration: aws.Int64(1),
  3083. MaxInstanceCount: aws.Int64(1),
  3084. MaxResults: aws.Int64(1),
  3085. MinDuration: aws.Int64(1),
  3086. NextToken: aws.String("String"),
  3087. OfferingClass: aws.String("OfferingClassType"),
  3088. OfferingType: aws.String("OfferingTypeValues"),
  3089. ProductDescription: aws.String("RIProductDescription"),
  3090. ReservedInstancesOfferingIds: []*string{
  3091. aws.String("String"), // Required
  3092. // More values...
  3093. },
  3094. }
  3095. resp, err := svc.DescribeReservedInstancesOfferings(params)
  3096. if err != nil {
  3097. // Print the error, cast err to awserr.Error to get the Code and
  3098. // Message from an error.
  3099. fmt.Println(err.Error())
  3100. return
  3101. }
  3102. // Pretty-print the response data.
  3103. fmt.Println(resp)
  3104. }
  3105. func ExampleEC2_DescribeRouteTables() {
  3106. sess, err := session.NewSession()
  3107. if err != nil {
  3108. fmt.Println("failed to create session,", err)
  3109. return
  3110. }
  3111. svc := ec2.New(sess)
  3112. params := &ec2.DescribeRouteTablesInput{
  3113. DryRun: aws.Bool(true),
  3114. Filters: []*ec2.Filter{
  3115. { // Required
  3116. Name: aws.String("String"),
  3117. Values: []*string{
  3118. aws.String("String"), // Required
  3119. // More values...
  3120. },
  3121. },
  3122. // More values...
  3123. },
  3124. RouteTableIds: []*string{
  3125. aws.String("String"), // Required
  3126. // More values...
  3127. },
  3128. }
  3129. resp, err := svc.DescribeRouteTables(params)
  3130. if err != nil {
  3131. // Print the error, cast err to awserr.Error to get the Code and
  3132. // Message from an error.
  3133. fmt.Println(err.Error())
  3134. return
  3135. }
  3136. // Pretty-print the response data.
  3137. fmt.Println(resp)
  3138. }
  3139. func ExampleEC2_DescribeScheduledInstanceAvailability() {
  3140. sess, err := session.NewSession()
  3141. if err != nil {
  3142. fmt.Println("failed to create session,", err)
  3143. return
  3144. }
  3145. svc := ec2.New(sess)
  3146. params := &ec2.DescribeScheduledInstanceAvailabilityInput{
  3147. FirstSlotStartTimeRange: &ec2.SlotDateTimeRangeRequest{ // Required
  3148. EarliestTime: aws.Time(time.Now()), // Required
  3149. LatestTime: aws.Time(time.Now()), // Required
  3150. },
  3151. Recurrence: &ec2.ScheduledInstanceRecurrenceRequest{ // Required
  3152. Frequency: aws.String("String"),
  3153. Interval: aws.Int64(1),
  3154. OccurrenceDays: []*int64{
  3155. aws.Int64(1), // Required
  3156. // More values...
  3157. },
  3158. OccurrenceRelativeToEnd: aws.Bool(true),
  3159. OccurrenceUnit: aws.String("String"),
  3160. },
  3161. DryRun: aws.Bool(true),
  3162. Filters: []*ec2.Filter{
  3163. { // Required
  3164. Name: aws.String("String"),
  3165. Values: []*string{
  3166. aws.String("String"), // Required
  3167. // More values...
  3168. },
  3169. },
  3170. // More values...
  3171. },
  3172. MaxResults: aws.Int64(1),
  3173. MaxSlotDurationInHours: aws.Int64(1),
  3174. MinSlotDurationInHours: aws.Int64(1),
  3175. NextToken: aws.String("String"),
  3176. }
  3177. resp, err := svc.DescribeScheduledInstanceAvailability(params)
  3178. if err != nil {
  3179. // Print the error, cast err to awserr.Error to get the Code and
  3180. // Message from an error.
  3181. fmt.Println(err.Error())
  3182. return
  3183. }
  3184. // Pretty-print the response data.
  3185. fmt.Println(resp)
  3186. }
  3187. func ExampleEC2_DescribeScheduledInstances() {
  3188. sess, err := session.NewSession()
  3189. if err != nil {
  3190. fmt.Println("failed to create session,", err)
  3191. return
  3192. }
  3193. svc := ec2.New(sess)
  3194. params := &ec2.DescribeScheduledInstancesInput{
  3195. DryRun: aws.Bool(true),
  3196. Filters: []*ec2.Filter{
  3197. { // Required
  3198. Name: aws.String("String"),
  3199. Values: []*string{
  3200. aws.String("String"), // Required
  3201. // More values...
  3202. },
  3203. },
  3204. // More values...
  3205. },
  3206. MaxResults: aws.Int64(1),
  3207. NextToken: aws.String("String"),
  3208. ScheduledInstanceIds: []*string{
  3209. aws.String("String"), // Required
  3210. // More values...
  3211. },
  3212. SlotStartTimeRange: &ec2.SlotStartTimeRangeRequest{
  3213. EarliestTime: aws.Time(time.Now()),
  3214. LatestTime: aws.Time(time.Now()),
  3215. },
  3216. }
  3217. resp, err := svc.DescribeScheduledInstances(params)
  3218. if err != nil {
  3219. // Print the error, cast err to awserr.Error to get the Code and
  3220. // Message from an error.
  3221. fmt.Println(err.Error())
  3222. return
  3223. }
  3224. // Pretty-print the response data.
  3225. fmt.Println(resp)
  3226. }
  3227. func ExampleEC2_DescribeSecurityGroupReferences() {
  3228. sess, err := session.NewSession()
  3229. if err != nil {
  3230. fmt.Println("failed to create session,", err)
  3231. return
  3232. }
  3233. svc := ec2.New(sess)
  3234. params := &ec2.DescribeSecurityGroupReferencesInput{
  3235. GroupId: []*string{ // Required
  3236. aws.String("String"), // Required
  3237. // More values...
  3238. },
  3239. DryRun: aws.Bool(true),
  3240. }
  3241. resp, err := svc.DescribeSecurityGroupReferences(params)
  3242. if err != nil {
  3243. // Print the error, cast err to awserr.Error to get the Code and
  3244. // Message from an error.
  3245. fmt.Println(err.Error())
  3246. return
  3247. }
  3248. // Pretty-print the response data.
  3249. fmt.Println(resp)
  3250. }
  3251. func ExampleEC2_DescribeSecurityGroups() {
  3252. sess, err := session.NewSession()
  3253. if err != nil {
  3254. fmt.Println("failed to create session,", err)
  3255. return
  3256. }
  3257. svc := ec2.New(sess)
  3258. params := &ec2.DescribeSecurityGroupsInput{
  3259. DryRun: aws.Bool(true),
  3260. Filters: []*ec2.Filter{
  3261. { // Required
  3262. Name: aws.String("String"),
  3263. Values: []*string{
  3264. aws.String("String"), // Required
  3265. // More values...
  3266. },
  3267. },
  3268. // More values...
  3269. },
  3270. GroupIds: []*string{
  3271. aws.String("String"), // Required
  3272. // More values...
  3273. },
  3274. GroupNames: []*string{
  3275. aws.String("String"), // Required
  3276. // More values...
  3277. },
  3278. }
  3279. resp, err := svc.DescribeSecurityGroups(params)
  3280. if err != nil {
  3281. // Print the error, cast err to awserr.Error to get the Code and
  3282. // Message from an error.
  3283. fmt.Println(err.Error())
  3284. return
  3285. }
  3286. // Pretty-print the response data.
  3287. fmt.Println(resp)
  3288. }
  3289. func ExampleEC2_DescribeSnapshotAttribute() {
  3290. sess, err := session.NewSession()
  3291. if err != nil {
  3292. fmt.Println("failed to create session,", err)
  3293. return
  3294. }
  3295. svc := ec2.New(sess)
  3296. params := &ec2.DescribeSnapshotAttributeInput{
  3297. Attribute: aws.String("SnapshotAttributeName"), // Required
  3298. SnapshotId: aws.String("String"), // Required
  3299. DryRun: aws.Bool(true),
  3300. }
  3301. resp, err := svc.DescribeSnapshotAttribute(params)
  3302. if err != nil {
  3303. // Print the error, cast err to awserr.Error to get the Code and
  3304. // Message from an error.
  3305. fmt.Println(err.Error())
  3306. return
  3307. }
  3308. // Pretty-print the response data.
  3309. fmt.Println(resp)
  3310. }
  3311. func ExampleEC2_DescribeSnapshots() {
  3312. sess, err := session.NewSession()
  3313. if err != nil {
  3314. fmt.Println("failed to create session,", err)
  3315. return
  3316. }
  3317. svc := ec2.New(sess)
  3318. params := &ec2.DescribeSnapshotsInput{
  3319. DryRun: aws.Bool(true),
  3320. Filters: []*ec2.Filter{
  3321. { // Required
  3322. Name: aws.String("String"),
  3323. Values: []*string{
  3324. aws.String("String"), // Required
  3325. // More values...
  3326. },
  3327. },
  3328. // More values...
  3329. },
  3330. MaxResults: aws.Int64(1),
  3331. NextToken: aws.String("String"),
  3332. OwnerIds: []*string{
  3333. aws.String("String"), // Required
  3334. // More values...
  3335. },
  3336. RestorableByUserIds: []*string{
  3337. aws.String("String"), // Required
  3338. // More values...
  3339. },
  3340. SnapshotIds: []*string{
  3341. aws.String("String"), // Required
  3342. // More values...
  3343. },
  3344. }
  3345. resp, err := svc.DescribeSnapshots(params)
  3346. if err != nil {
  3347. // Print the error, cast err to awserr.Error to get the Code and
  3348. // Message from an error.
  3349. fmt.Println(err.Error())
  3350. return
  3351. }
  3352. // Pretty-print the response data.
  3353. fmt.Println(resp)
  3354. }
  3355. func ExampleEC2_DescribeSpotDatafeedSubscription() {
  3356. sess, err := session.NewSession()
  3357. if err != nil {
  3358. fmt.Println("failed to create session,", err)
  3359. return
  3360. }
  3361. svc := ec2.New(sess)
  3362. params := &ec2.DescribeSpotDatafeedSubscriptionInput{
  3363. DryRun: aws.Bool(true),
  3364. }
  3365. resp, err := svc.DescribeSpotDatafeedSubscription(params)
  3366. if err != nil {
  3367. // Print the error, cast err to awserr.Error to get the Code and
  3368. // Message from an error.
  3369. fmt.Println(err.Error())
  3370. return
  3371. }
  3372. // Pretty-print the response data.
  3373. fmt.Println(resp)
  3374. }
  3375. func ExampleEC2_DescribeSpotFleetInstances() {
  3376. sess, err := session.NewSession()
  3377. if err != nil {
  3378. fmt.Println("failed to create session,", err)
  3379. return
  3380. }
  3381. svc := ec2.New(sess)
  3382. params := &ec2.DescribeSpotFleetInstancesInput{
  3383. SpotFleetRequestId: aws.String("String"), // Required
  3384. DryRun: aws.Bool(true),
  3385. MaxResults: aws.Int64(1),
  3386. NextToken: aws.String("String"),
  3387. }
  3388. resp, err := svc.DescribeSpotFleetInstances(params)
  3389. if err != nil {
  3390. // Print the error, cast err to awserr.Error to get the Code and
  3391. // Message from an error.
  3392. fmt.Println(err.Error())
  3393. return
  3394. }
  3395. // Pretty-print the response data.
  3396. fmt.Println(resp)
  3397. }
  3398. func ExampleEC2_DescribeSpotFleetRequestHistory() {
  3399. sess, err := session.NewSession()
  3400. if err != nil {
  3401. fmt.Println("failed to create session,", err)
  3402. return
  3403. }
  3404. svc := ec2.New(sess)
  3405. params := &ec2.DescribeSpotFleetRequestHistoryInput{
  3406. SpotFleetRequestId: aws.String("String"), // Required
  3407. StartTime: aws.Time(time.Now()), // Required
  3408. DryRun: aws.Bool(true),
  3409. EventType: aws.String("EventType"),
  3410. MaxResults: aws.Int64(1),
  3411. NextToken: aws.String("String"),
  3412. }
  3413. resp, err := svc.DescribeSpotFleetRequestHistory(params)
  3414. if err != nil {
  3415. // Print the error, cast err to awserr.Error to get the Code and
  3416. // Message from an error.
  3417. fmt.Println(err.Error())
  3418. return
  3419. }
  3420. // Pretty-print the response data.
  3421. fmt.Println(resp)
  3422. }
  3423. func ExampleEC2_DescribeSpotFleetRequests() {
  3424. sess, err := session.NewSession()
  3425. if err != nil {
  3426. fmt.Println("failed to create session,", err)
  3427. return
  3428. }
  3429. svc := ec2.New(sess)
  3430. params := &ec2.DescribeSpotFleetRequestsInput{
  3431. DryRun: aws.Bool(true),
  3432. MaxResults: aws.Int64(1),
  3433. NextToken: aws.String("String"),
  3434. SpotFleetRequestIds: []*string{
  3435. aws.String("String"), // Required
  3436. // More values...
  3437. },
  3438. }
  3439. resp, err := svc.DescribeSpotFleetRequests(params)
  3440. if err != nil {
  3441. // Print the error, cast err to awserr.Error to get the Code and
  3442. // Message from an error.
  3443. fmt.Println(err.Error())
  3444. return
  3445. }
  3446. // Pretty-print the response data.
  3447. fmt.Println(resp)
  3448. }
  3449. func ExampleEC2_DescribeSpotInstanceRequests() {
  3450. sess, err := session.NewSession()
  3451. if err != nil {
  3452. fmt.Println("failed to create session,", err)
  3453. return
  3454. }
  3455. svc := ec2.New(sess)
  3456. params := &ec2.DescribeSpotInstanceRequestsInput{
  3457. DryRun: aws.Bool(true),
  3458. Filters: []*ec2.Filter{
  3459. { // Required
  3460. Name: aws.String("String"),
  3461. Values: []*string{
  3462. aws.String("String"), // Required
  3463. // More values...
  3464. },
  3465. },
  3466. // More values...
  3467. },
  3468. SpotInstanceRequestIds: []*string{
  3469. aws.String("String"), // Required
  3470. // More values...
  3471. },
  3472. }
  3473. resp, err := svc.DescribeSpotInstanceRequests(params)
  3474. if err != nil {
  3475. // Print the error, cast err to awserr.Error to get the Code and
  3476. // Message from an error.
  3477. fmt.Println(err.Error())
  3478. return
  3479. }
  3480. // Pretty-print the response data.
  3481. fmt.Println(resp)
  3482. }
  3483. func ExampleEC2_DescribeSpotPriceHistory() {
  3484. sess, err := session.NewSession()
  3485. if err != nil {
  3486. fmt.Println("failed to create session,", err)
  3487. return
  3488. }
  3489. svc := ec2.New(sess)
  3490. params := &ec2.DescribeSpotPriceHistoryInput{
  3491. AvailabilityZone: aws.String("String"),
  3492. DryRun: aws.Bool(true),
  3493. EndTime: aws.Time(time.Now()),
  3494. Filters: []*ec2.Filter{
  3495. { // Required
  3496. Name: aws.String("String"),
  3497. Values: []*string{
  3498. aws.String("String"), // Required
  3499. // More values...
  3500. },
  3501. },
  3502. // More values...
  3503. },
  3504. InstanceTypes: []*string{
  3505. aws.String("InstanceType"), // Required
  3506. // More values...
  3507. },
  3508. MaxResults: aws.Int64(1),
  3509. NextToken: aws.String("String"),
  3510. ProductDescriptions: []*string{
  3511. aws.String("String"), // Required
  3512. // More values...
  3513. },
  3514. StartTime: aws.Time(time.Now()),
  3515. }
  3516. resp, err := svc.DescribeSpotPriceHistory(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_DescribeStaleSecurityGroups() {
  3527. sess, err := session.NewSession()
  3528. if err != nil {
  3529. fmt.Println("failed to create session,", err)
  3530. return
  3531. }
  3532. svc := ec2.New(sess)
  3533. params := &ec2.DescribeStaleSecurityGroupsInput{
  3534. VpcId: aws.String("String"), // Required
  3535. DryRun: aws.Bool(true),
  3536. MaxResults: aws.Int64(1),
  3537. NextToken: aws.String("NextToken"),
  3538. }
  3539. resp, err := svc.DescribeStaleSecurityGroups(params)
  3540. if err != nil {
  3541. // Print the error, cast err to awserr.Error to get the Code and
  3542. // Message from an error.
  3543. fmt.Println(err.Error())
  3544. return
  3545. }
  3546. // Pretty-print the response data.
  3547. fmt.Println(resp)
  3548. }
  3549. func ExampleEC2_DescribeSubnets() {
  3550. sess, err := session.NewSession()
  3551. if err != nil {
  3552. fmt.Println("failed to create session,", err)
  3553. return
  3554. }
  3555. svc := ec2.New(sess)
  3556. params := &ec2.DescribeSubnetsInput{
  3557. DryRun: aws.Bool(true),
  3558. Filters: []*ec2.Filter{
  3559. { // Required
  3560. Name: aws.String("String"),
  3561. Values: []*string{
  3562. aws.String("String"), // Required
  3563. // More values...
  3564. },
  3565. },
  3566. // More values...
  3567. },
  3568. SubnetIds: []*string{
  3569. aws.String("String"), // Required
  3570. // More values...
  3571. },
  3572. }
  3573. resp, err := svc.DescribeSubnets(params)
  3574. if err != nil {
  3575. // Print the error, cast err to awserr.Error to get the Code and
  3576. // Message from an error.
  3577. fmt.Println(err.Error())
  3578. return
  3579. }
  3580. // Pretty-print the response data.
  3581. fmt.Println(resp)
  3582. }
  3583. func ExampleEC2_DescribeTags() {
  3584. sess, err := session.NewSession()
  3585. if err != nil {
  3586. fmt.Println("failed to create session,", err)
  3587. return
  3588. }
  3589. svc := ec2.New(sess)
  3590. params := &ec2.DescribeTagsInput{
  3591. DryRun: aws.Bool(true),
  3592. Filters: []*ec2.Filter{
  3593. { // Required
  3594. Name: aws.String("String"),
  3595. Values: []*string{
  3596. aws.String("String"), // Required
  3597. // More values...
  3598. },
  3599. },
  3600. // More values...
  3601. },
  3602. MaxResults: aws.Int64(1),
  3603. NextToken: aws.String("String"),
  3604. }
  3605. resp, err := svc.DescribeTags(params)
  3606. if err != nil {
  3607. // Print the error, cast err to awserr.Error to get the Code and
  3608. // Message from an error.
  3609. fmt.Println(err.Error())
  3610. return
  3611. }
  3612. // Pretty-print the response data.
  3613. fmt.Println(resp)
  3614. }
  3615. func ExampleEC2_DescribeVolumeAttribute() {
  3616. sess, err := session.NewSession()
  3617. if err != nil {
  3618. fmt.Println("failed to create session,", err)
  3619. return
  3620. }
  3621. svc := ec2.New(sess)
  3622. params := &ec2.DescribeVolumeAttributeInput{
  3623. VolumeId: aws.String("String"), // Required
  3624. Attribute: aws.String("VolumeAttributeName"),
  3625. DryRun: aws.Bool(true),
  3626. }
  3627. resp, err := svc.DescribeVolumeAttribute(params)
  3628. if err != nil {
  3629. // Print the error, cast err to awserr.Error to get the Code and
  3630. // Message from an error.
  3631. fmt.Println(err.Error())
  3632. return
  3633. }
  3634. // Pretty-print the response data.
  3635. fmt.Println(resp)
  3636. }
  3637. func ExampleEC2_DescribeVolumeStatus() {
  3638. sess, err := session.NewSession()
  3639. if err != nil {
  3640. fmt.Println("failed to create session,", err)
  3641. return
  3642. }
  3643. svc := ec2.New(sess)
  3644. params := &ec2.DescribeVolumeStatusInput{
  3645. DryRun: aws.Bool(true),
  3646. Filters: []*ec2.Filter{
  3647. { // Required
  3648. Name: aws.String("String"),
  3649. Values: []*string{
  3650. aws.String("String"), // Required
  3651. // More values...
  3652. },
  3653. },
  3654. // More values...
  3655. },
  3656. MaxResults: aws.Int64(1),
  3657. NextToken: aws.String("String"),
  3658. VolumeIds: []*string{
  3659. aws.String("String"), // Required
  3660. // More values...
  3661. },
  3662. }
  3663. resp, err := svc.DescribeVolumeStatus(params)
  3664. if err != nil {
  3665. // Print the error, cast err to awserr.Error to get the Code and
  3666. // Message from an error.
  3667. fmt.Println(err.Error())
  3668. return
  3669. }
  3670. // Pretty-print the response data.
  3671. fmt.Println(resp)
  3672. }
  3673. func ExampleEC2_DescribeVolumes() {
  3674. sess, err := session.NewSession()
  3675. if err != nil {
  3676. fmt.Println("failed to create session,", err)
  3677. return
  3678. }
  3679. svc := ec2.New(sess)
  3680. params := &ec2.DescribeVolumesInput{
  3681. DryRun: aws.Bool(true),
  3682. Filters: []*ec2.Filter{
  3683. { // Required
  3684. Name: aws.String("String"),
  3685. Values: []*string{
  3686. aws.String("String"), // Required
  3687. // More values...
  3688. },
  3689. },
  3690. // More values...
  3691. },
  3692. MaxResults: aws.Int64(1),
  3693. NextToken: aws.String("String"),
  3694. VolumeIds: []*string{
  3695. aws.String("String"), // Required
  3696. // More values...
  3697. },
  3698. }
  3699. resp, err := svc.DescribeVolumes(params)
  3700. if err != nil {
  3701. // Print the error, cast err to awserr.Error to get the Code and
  3702. // Message from an error.
  3703. fmt.Println(err.Error())
  3704. return
  3705. }
  3706. // Pretty-print the response data.
  3707. fmt.Println(resp)
  3708. }
  3709. func ExampleEC2_DescribeVpcAttribute() {
  3710. sess, err := session.NewSession()
  3711. if err != nil {
  3712. fmt.Println("failed to create session,", err)
  3713. return
  3714. }
  3715. svc := ec2.New(sess)
  3716. params := &ec2.DescribeVpcAttributeInput{
  3717. Attribute: aws.String("VpcAttributeName"), // Required
  3718. VpcId: aws.String("String"), // Required
  3719. DryRun: aws.Bool(true),
  3720. }
  3721. resp, err := svc.DescribeVpcAttribute(params)
  3722. if err != nil {
  3723. // Print the error, cast err to awserr.Error to get the Code and
  3724. // Message from an error.
  3725. fmt.Println(err.Error())
  3726. return
  3727. }
  3728. // Pretty-print the response data.
  3729. fmt.Println(resp)
  3730. }
  3731. func ExampleEC2_DescribeVpcClassicLink() {
  3732. sess, err := session.NewSession()
  3733. if err != nil {
  3734. fmt.Println("failed to create session,", err)
  3735. return
  3736. }
  3737. svc := ec2.New(sess)
  3738. params := &ec2.DescribeVpcClassicLinkInput{
  3739. DryRun: aws.Bool(true),
  3740. Filters: []*ec2.Filter{
  3741. { // Required
  3742. Name: aws.String("String"),
  3743. Values: []*string{
  3744. aws.String("String"), // Required
  3745. // More values...
  3746. },
  3747. },
  3748. // More values...
  3749. },
  3750. VpcIds: []*string{
  3751. aws.String("String"), // Required
  3752. // More values...
  3753. },
  3754. }
  3755. resp, err := svc.DescribeVpcClassicLink(params)
  3756. if err != nil {
  3757. // Print the error, cast err to awserr.Error to get the Code and
  3758. // Message from an error.
  3759. fmt.Println(err.Error())
  3760. return
  3761. }
  3762. // Pretty-print the response data.
  3763. fmt.Println(resp)
  3764. }
  3765. func ExampleEC2_DescribeVpcClassicLinkDnsSupport() {
  3766. sess, err := session.NewSession()
  3767. if err != nil {
  3768. fmt.Println("failed to create session,", err)
  3769. return
  3770. }
  3771. svc := ec2.New(sess)
  3772. params := &ec2.DescribeVpcClassicLinkDnsSupportInput{
  3773. MaxResults: aws.Int64(1),
  3774. NextToken: aws.String("NextToken"),
  3775. VpcIds: []*string{
  3776. aws.String("String"), // Required
  3777. // More values...
  3778. },
  3779. }
  3780. resp, err := svc.DescribeVpcClassicLinkDnsSupport(params)
  3781. if err != nil {
  3782. // Print the error, cast err to awserr.Error to get the Code and
  3783. // Message from an error.
  3784. fmt.Println(err.Error())
  3785. return
  3786. }
  3787. // Pretty-print the response data.
  3788. fmt.Println(resp)
  3789. }
  3790. func ExampleEC2_DescribeVpcEndpointServices() {
  3791. sess, err := session.NewSession()
  3792. if err != nil {
  3793. fmt.Println("failed to create session,", err)
  3794. return
  3795. }
  3796. svc := ec2.New(sess)
  3797. params := &ec2.DescribeVpcEndpointServicesInput{
  3798. DryRun: aws.Bool(true),
  3799. MaxResults: aws.Int64(1),
  3800. NextToken: aws.String("String"),
  3801. }
  3802. resp, err := svc.DescribeVpcEndpointServices(params)
  3803. if err != nil {
  3804. // Print the error, cast err to awserr.Error to get the Code and
  3805. // Message from an error.
  3806. fmt.Println(err.Error())
  3807. return
  3808. }
  3809. // Pretty-print the response data.
  3810. fmt.Println(resp)
  3811. }
  3812. func ExampleEC2_DescribeVpcEndpoints() {
  3813. sess, err := session.NewSession()
  3814. if err != nil {
  3815. fmt.Println("failed to create session,", err)
  3816. return
  3817. }
  3818. svc := ec2.New(sess)
  3819. params := &ec2.DescribeVpcEndpointsInput{
  3820. DryRun: aws.Bool(true),
  3821. Filters: []*ec2.Filter{
  3822. { // Required
  3823. Name: aws.String("String"),
  3824. Values: []*string{
  3825. aws.String("String"), // Required
  3826. // More values...
  3827. },
  3828. },
  3829. // More values...
  3830. },
  3831. MaxResults: aws.Int64(1),
  3832. NextToken: aws.String("String"),
  3833. VpcEndpointIds: []*string{
  3834. aws.String("String"), // Required
  3835. // More values...
  3836. },
  3837. }
  3838. resp, err := svc.DescribeVpcEndpoints(params)
  3839. if err != nil {
  3840. // Print the error, cast err to awserr.Error to get the Code and
  3841. // Message from an error.
  3842. fmt.Println(err.Error())
  3843. return
  3844. }
  3845. // Pretty-print the response data.
  3846. fmt.Println(resp)
  3847. }
  3848. func ExampleEC2_DescribeVpcPeeringConnections() {
  3849. sess, err := session.NewSession()
  3850. if err != nil {
  3851. fmt.Println("failed to create session,", err)
  3852. return
  3853. }
  3854. svc := ec2.New(sess)
  3855. params := &ec2.DescribeVpcPeeringConnectionsInput{
  3856. DryRun: aws.Bool(true),
  3857. Filters: []*ec2.Filter{
  3858. { // Required
  3859. Name: aws.String("String"),
  3860. Values: []*string{
  3861. aws.String("String"), // Required
  3862. // More values...
  3863. },
  3864. },
  3865. // More values...
  3866. },
  3867. VpcPeeringConnectionIds: []*string{
  3868. aws.String("String"), // Required
  3869. // More values...
  3870. },
  3871. }
  3872. resp, err := svc.DescribeVpcPeeringConnections(params)
  3873. if err != nil {
  3874. // Print the error, cast err to awserr.Error to get the Code and
  3875. // Message from an error.
  3876. fmt.Println(err.Error())
  3877. return
  3878. }
  3879. // Pretty-print the response data.
  3880. fmt.Println(resp)
  3881. }
  3882. func ExampleEC2_DescribeVpcs() {
  3883. sess, err := session.NewSession()
  3884. if err != nil {
  3885. fmt.Println("failed to create session,", err)
  3886. return
  3887. }
  3888. svc := ec2.New(sess)
  3889. params := &ec2.DescribeVpcsInput{
  3890. DryRun: aws.Bool(true),
  3891. Filters: []*ec2.Filter{
  3892. { // Required
  3893. Name: aws.String("String"),
  3894. Values: []*string{
  3895. aws.String("String"), // Required
  3896. // More values...
  3897. },
  3898. },
  3899. // More values...
  3900. },
  3901. VpcIds: []*string{
  3902. aws.String("String"), // Required
  3903. // More values...
  3904. },
  3905. }
  3906. resp, err := svc.DescribeVpcs(params)
  3907. if err != nil {
  3908. // Print the error, cast err to awserr.Error to get the Code and
  3909. // Message from an error.
  3910. fmt.Println(err.Error())
  3911. return
  3912. }
  3913. // Pretty-print the response data.
  3914. fmt.Println(resp)
  3915. }
  3916. func ExampleEC2_DescribeVpnConnections() {
  3917. sess, err := session.NewSession()
  3918. if err != nil {
  3919. fmt.Println("failed to create session,", err)
  3920. return
  3921. }
  3922. svc := ec2.New(sess)
  3923. params := &ec2.DescribeVpnConnectionsInput{
  3924. DryRun: aws.Bool(true),
  3925. Filters: []*ec2.Filter{
  3926. { // Required
  3927. Name: aws.String("String"),
  3928. Values: []*string{
  3929. aws.String("String"), // Required
  3930. // More values...
  3931. },
  3932. },
  3933. // More values...
  3934. },
  3935. VpnConnectionIds: []*string{
  3936. aws.String("String"), // Required
  3937. // More values...
  3938. },
  3939. }
  3940. resp, err := svc.DescribeVpnConnections(params)
  3941. if err != nil {
  3942. // Print the error, cast err to awserr.Error to get the Code and
  3943. // Message from an error.
  3944. fmt.Println(err.Error())
  3945. return
  3946. }
  3947. // Pretty-print the response data.
  3948. fmt.Println(resp)
  3949. }
  3950. func ExampleEC2_DescribeVpnGateways() {
  3951. sess, err := session.NewSession()
  3952. if err != nil {
  3953. fmt.Println("failed to create session,", err)
  3954. return
  3955. }
  3956. svc := ec2.New(sess)
  3957. params := &ec2.DescribeVpnGatewaysInput{
  3958. DryRun: aws.Bool(true),
  3959. Filters: []*ec2.Filter{
  3960. { // Required
  3961. Name: aws.String("String"),
  3962. Values: []*string{
  3963. aws.String("String"), // Required
  3964. // More values...
  3965. },
  3966. },
  3967. // More values...
  3968. },
  3969. VpnGatewayIds: []*string{
  3970. aws.String("String"), // Required
  3971. // More values...
  3972. },
  3973. }
  3974. resp, err := svc.DescribeVpnGateways(params)
  3975. if err != nil {
  3976. // Print the error, cast err to awserr.Error to get the Code and
  3977. // Message from an error.
  3978. fmt.Println(err.Error())
  3979. return
  3980. }
  3981. // Pretty-print the response data.
  3982. fmt.Println(resp)
  3983. }
  3984. func ExampleEC2_DetachClassicLinkVpc() {
  3985. sess, err := session.NewSession()
  3986. if err != nil {
  3987. fmt.Println("failed to create session,", err)
  3988. return
  3989. }
  3990. svc := ec2.New(sess)
  3991. params := &ec2.DetachClassicLinkVpcInput{
  3992. InstanceId: aws.String("String"), // Required
  3993. VpcId: aws.String("String"), // Required
  3994. DryRun: aws.Bool(true),
  3995. }
  3996. resp, err := svc.DetachClassicLinkVpc(params)
  3997. if err != nil {
  3998. // Print the error, cast err to awserr.Error to get the Code and
  3999. // Message from an error.
  4000. fmt.Println(err.Error())
  4001. return
  4002. }
  4003. // Pretty-print the response data.
  4004. fmt.Println(resp)
  4005. }
  4006. func ExampleEC2_DetachInternetGateway() {
  4007. sess, err := session.NewSession()
  4008. if err != nil {
  4009. fmt.Println("failed to create session,", err)
  4010. return
  4011. }
  4012. svc := ec2.New(sess)
  4013. params := &ec2.DetachInternetGatewayInput{
  4014. InternetGatewayId: aws.String("String"), // Required
  4015. VpcId: aws.String("String"), // Required
  4016. DryRun: aws.Bool(true),
  4017. }
  4018. resp, err := svc.DetachInternetGateway(params)
  4019. if err != nil {
  4020. // Print the error, cast err to awserr.Error to get the Code and
  4021. // Message from an error.
  4022. fmt.Println(err.Error())
  4023. return
  4024. }
  4025. // Pretty-print the response data.
  4026. fmt.Println(resp)
  4027. }
  4028. func ExampleEC2_DetachNetworkInterface() {
  4029. sess, err := session.NewSession()
  4030. if err != nil {
  4031. fmt.Println("failed to create session,", err)
  4032. return
  4033. }
  4034. svc := ec2.New(sess)
  4035. params := &ec2.DetachNetworkInterfaceInput{
  4036. AttachmentId: aws.String("String"), // Required
  4037. DryRun: aws.Bool(true),
  4038. Force: aws.Bool(true),
  4039. }
  4040. resp, err := svc.DetachNetworkInterface(params)
  4041. if err != nil {
  4042. // Print the error, cast err to awserr.Error to get the Code and
  4043. // Message from an error.
  4044. fmt.Println(err.Error())
  4045. return
  4046. }
  4047. // Pretty-print the response data.
  4048. fmt.Println(resp)
  4049. }
  4050. func ExampleEC2_DetachVolume() {
  4051. sess, err := session.NewSession()
  4052. if err != nil {
  4053. fmt.Println("failed to create session,", err)
  4054. return
  4055. }
  4056. svc := ec2.New(sess)
  4057. params := &ec2.DetachVolumeInput{
  4058. VolumeId: aws.String("String"), // Required
  4059. Device: aws.String("String"),
  4060. DryRun: aws.Bool(true),
  4061. Force: aws.Bool(true),
  4062. InstanceId: aws.String("String"),
  4063. }
  4064. resp, err := svc.DetachVolume(params)
  4065. if err != nil {
  4066. // Print the error, cast err to awserr.Error to get the Code and
  4067. // Message from an error.
  4068. fmt.Println(err.Error())
  4069. return
  4070. }
  4071. // Pretty-print the response data.
  4072. fmt.Println(resp)
  4073. }
  4074. func ExampleEC2_DetachVpnGateway() {
  4075. sess, err := session.NewSession()
  4076. if err != nil {
  4077. fmt.Println("failed to create session,", err)
  4078. return
  4079. }
  4080. svc := ec2.New(sess)
  4081. params := &ec2.DetachVpnGatewayInput{
  4082. VpcId: aws.String("String"), // Required
  4083. VpnGatewayId: aws.String("String"), // Required
  4084. DryRun: aws.Bool(true),
  4085. }
  4086. resp, err := svc.DetachVpnGateway(params)
  4087. if err != nil {
  4088. // Print the error, cast err to awserr.Error to get the Code and
  4089. // Message from an error.
  4090. fmt.Println(err.Error())
  4091. return
  4092. }
  4093. // Pretty-print the response data.
  4094. fmt.Println(resp)
  4095. }
  4096. func ExampleEC2_DisableVgwRoutePropagation() {
  4097. sess, err := session.NewSession()
  4098. if err != nil {
  4099. fmt.Println("failed to create session,", err)
  4100. return
  4101. }
  4102. svc := ec2.New(sess)
  4103. params := &ec2.DisableVgwRoutePropagationInput{
  4104. GatewayId: aws.String("String"), // Required
  4105. RouteTableId: aws.String("String"), // Required
  4106. }
  4107. resp, err := svc.DisableVgwRoutePropagation(params)
  4108. if err != nil {
  4109. // Print the error, cast err to awserr.Error to get the Code and
  4110. // Message from an error.
  4111. fmt.Println(err.Error())
  4112. return
  4113. }
  4114. // Pretty-print the response data.
  4115. fmt.Println(resp)
  4116. }
  4117. func ExampleEC2_DisableVpcClassicLink() {
  4118. sess, err := session.NewSession()
  4119. if err != nil {
  4120. fmt.Println("failed to create session,", err)
  4121. return
  4122. }
  4123. svc := ec2.New(sess)
  4124. params := &ec2.DisableVpcClassicLinkInput{
  4125. VpcId: aws.String("String"), // Required
  4126. DryRun: aws.Bool(true),
  4127. }
  4128. resp, err := svc.DisableVpcClassicLink(params)
  4129. if err != nil {
  4130. // Print the error, cast err to awserr.Error to get the Code and
  4131. // Message from an error.
  4132. fmt.Println(err.Error())
  4133. return
  4134. }
  4135. // Pretty-print the response data.
  4136. fmt.Println(resp)
  4137. }
  4138. func ExampleEC2_DisableVpcClassicLinkDnsSupport() {
  4139. sess, err := session.NewSession()
  4140. if err != nil {
  4141. fmt.Println("failed to create session,", err)
  4142. return
  4143. }
  4144. svc := ec2.New(sess)
  4145. params := &ec2.DisableVpcClassicLinkDnsSupportInput{
  4146. VpcId: aws.String("String"),
  4147. }
  4148. resp, err := svc.DisableVpcClassicLinkDnsSupport(params)
  4149. if err != nil {
  4150. // Print the error, cast err to awserr.Error to get the Code and
  4151. // Message from an error.
  4152. fmt.Println(err.Error())
  4153. return
  4154. }
  4155. // Pretty-print the response data.
  4156. fmt.Println(resp)
  4157. }
  4158. func ExampleEC2_DisassociateAddress() {
  4159. sess, err := session.NewSession()
  4160. if err != nil {
  4161. fmt.Println("failed to create session,", err)
  4162. return
  4163. }
  4164. svc := ec2.New(sess)
  4165. params := &ec2.DisassociateAddressInput{
  4166. AssociationId: aws.String("String"),
  4167. DryRun: aws.Bool(true),
  4168. PublicIp: aws.String("String"),
  4169. }
  4170. resp, err := svc.DisassociateAddress(params)
  4171. if err != nil {
  4172. // Print the error, cast err to awserr.Error to get the Code and
  4173. // Message from an error.
  4174. fmt.Println(err.Error())
  4175. return
  4176. }
  4177. // Pretty-print the response data.
  4178. fmt.Println(resp)
  4179. }
  4180. func ExampleEC2_DisassociateRouteTable() {
  4181. sess, err := session.NewSession()
  4182. if err != nil {
  4183. fmt.Println("failed to create session,", err)
  4184. return
  4185. }
  4186. svc := ec2.New(sess)
  4187. params := &ec2.DisassociateRouteTableInput{
  4188. AssociationId: aws.String("String"), // Required
  4189. DryRun: aws.Bool(true),
  4190. }
  4191. resp, err := svc.DisassociateRouteTable(params)
  4192. if err != nil {
  4193. // Print the error, cast err to awserr.Error to get the Code and
  4194. // Message from an error.
  4195. fmt.Println(err.Error())
  4196. return
  4197. }
  4198. // Pretty-print the response data.
  4199. fmt.Println(resp)
  4200. }
  4201. func ExampleEC2_EnableVgwRoutePropagation() {
  4202. sess, err := session.NewSession()
  4203. if err != nil {
  4204. fmt.Println("failed to create session,", err)
  4205. return
  4206. }
  4207. svc := ec2.New(sess)
  4208. params := &ec2.EnableVgwRoutePropagationInput{
  4209. GatewayId: aws.String("String"), // Required
  4210. RouteTableId: aws.String("String"), // Required
  4211. }
  4212. resp, err := svc.EnableVgwRoutePropagation(params)
  4213. if err != nil {
  4214. // Print the error, cast err to awserr.Error to get the Code and
  4215. // Message from an error.
  4216. fmt.Println(err.Error())
  4217. return
  4218. }
  4219. // Pretty-print the response data.
  4220. fmt.Println(resp)
  4221. }
  4222. func ExampleEC2_EnableVolumeIO() {
  4223. sess, err := session.NewSession()
  4224. if err != nil {
  4225. fmt.Println("failed to create session,", err)
  4226. return
  4227. }
  4228. svc := ec2.New(sess)
  4229. params := &ec2.EnableVolumeIOInput{
  4230. VolumeId: aws.String("String"), // Required
  4231. DryRun: aws.Bool(true),
  4232. }
  4233. resp, err := svc.EnableVolumeIO(params)
  4234. if err != nil {
  4235. // Print the error, cast err to awserr.Error to get the Code and
  4236. // Message from an error.
  4237. fmt.Println(err.Error())
  4238. return
  4239. }
  4240. // Pretty-print the response data.
  4241. fmt.Println(resp)
  4242. }
  4243. func ExampleEC2_EnableVpcClassicLink() {
  4244. sess, err := session.NewSession()
  4245. if err != nil {
  4246. fmt.Println("failed to create session,", err)
  4247. return
  4248. }
  4249. svc := ec2.New(sess)
  4250. params := &ec2.EnableVpcClassicLinkInput{
  4251. VpcId: aws.String("String"), // Required
  4252. DryRun: aws.Bool(true),
  4253. }
  4254. resp, err := svc.EnableVpcClassicLink(params)
  4255. if err != nil {
  4256. // Print the error, cast err to awserr.Error to get the Code and
  4257. // Message from an error.
  4258. fmt.Println(err.Error())
  4259. return
  4260. }
  4261. // Pretty-print the response data.
  4262. fmt.Println(resp)
  4263. }
  4264. func ExampleEC2_EnableVpcClassicLinkDnsSupport() {
  4265. sess, err := session.NewSession()
  4266. if err != nil {
  4267. fmt.Println("failed to create session,", err)
  4268. return
  4269. }
  4270. svc := ec2.New(sess)
  4271. params := &ec2.EnableVpcClassicLinkDnsSupportInput{
  4272. VpcId: aws.String("String"),
  4273. }
  4274. resp, err := svc.EnableVpcClassicLinkDnsSupport(params)
  4275. if err != nil {
  4276. // Print the error, cast err to awserr.Error to get the Code and
  4277. // Message from an error.
  4278. fmt.Println(err.Error())
  4279. return
  4280. }
  4281. // Pretty-print the response data.
  4282. fmt.Println(resp)
  4283. }
  4284. func ExampleEC2_GetConsoleOutput() {
  4285. sess, err := session.NewSession()
  4286. if err != nil {
  4287. fmt.Println("failed to create session,", err)
  4288. return
  4289. }
  4290. svc := ec2.New(sess)
  4291. params := &ec2.GetConsoleOutputInput{
  4292. InstanceId: aws.String("String"), // Required
  4293. DryRun: aws.Bool(true),
  4294. }
  4295. resp, err := svc.GetConsoleOutput(params)
  4296. if err != nil {
  4297. // Print the error, cast err to awserr.Error to get the Code and
  4298. // Message from an error.
  4299. fmt.Println(err.Error())
  4300. return
  4301. }
  4302. // Pretty-print the response data.
  4303. fmt.Println(resp)
  4304. }
  4305. func ExampleEC2_GetConsoleScreenshot() {
  4306. sess, err := session.NewSession()
  4307. if err != nil {
  4308. fmt.Println("failed to create session,", err)
  4309. return
  4310. }
  4311. svc := ec2.New(sess)
  4312. params := &ec2.GetConsoleScreenshotInput{
  4313. InstanceId: aws.String("String"), // Required
  4314. DryRun: aws.Bool(true),
  4315. WakeUp: aws.Bool(true),
  4316. }
  4317. resp, err := svc.GetConsoleScreenshot(params)
  4318. if err != nil {
  4319. // Print the error, cast err to awserr.Error to get the Code and
  4320. // Message from an error.
  4321. fmt.Println(err.Error())
  4322. return
  4323. }
  4324. // Pretty-print the response data.
  4325. fmt.Println(resp)
  4326. }
  4327. func ExampleEC2_GetHostReservationPurchasePreview() {
  4328. sess, err := session.NewSession()
  4329. if err != nil {
  4330. fmt.Println("failed to create session,", err)
  4331. return
  4332. }
  4333. svc := ec2.New(sess)
  4334. params := &ec2.GetHostReservationPurchasePreviewInput{
  4335. HostIdSet: []*string{ // Required
  4336. aws.String("String"), // Required
  4337. // More values...
  4338. },
  4339. OfferingId: aws.String("String"), // Required
  4340. }
  4341. resp, err := svc.GetHostReservationPurchasePreview(params)
  4342. if err != nil {
  4343. // Print the error, cast err to awserr.Error to get the Code and
  4344. // Message from an error.
  4345. fmt.Println(err.Error())
  4346. return
  4347. }
  4348. // Pretty-print the response data.
  4349. fmt.Println(resp)
  4350. }
  4351. func ExampleEC2_GetPasswordData() {
  4352. sess, err := session.NewSession()
  4353. if err != nil {
  4354. fmt.Println("failed to create session,", err)
  4355. return
  4356. }
  4357. svc := ec2.New(sess)
  4358. params := &ec2.GetPasswordDataInput{
  4359. InstanceId: aws.String("String"), // Required
  4360. DryRun: aws.Bool(true),
  4361. }
  4362. resp, err := svc.GetPasswordData(params)
  4363. if err != nil {
  4364. // Print the error, cast err to awserr.Error to get the Code and
  4365. // Message from an error.
  4366. fmt.Println(err.Error())
  4367. return
  4368. }
  4369. // Pretty-print the response data.
  4370. fmt.Println(resp)
  4371. }
  4372. func ExampleEC2_GetReservedInstancesExchangeQuote() {
  4373. sess, err := session.NewSession()
  4374. if err != nil {
  4375. fmt.Println("failed to create session,", err)
  4376. return
  4377. }
  4378. svc := ec2.New(sess)
  4379. params := &ec2.GetReservedInstancesExchangeQuoteInput{
  4380. ReservedInstanceIds: []*string{ // Required
  4381. aws.String("String"), // Required
  4382. // More values...
  4383. },
  4384. DryRun: aws.Bool(true),
  4385. TargetConfigurations: []*ec2.TargetConfigurationRequest{
  4386. { // Required
  4387. OfferingId: aws.String("String"), // Required
  4388. InstanceCount: aws.Int64(1),
  4389. },
  4390. // More values...
  4391. },
  4392. }
  4393. resp, err := svc.GetReservedInstancesExchangeQuote(params)
  4394. if err != nil {
  4395. // Print the error, cast err to awserr.Error to get the Code and
  4396. // Message from an error.
  4397. fmt.Println(err.Error())
  4398. return
  4399. }
  4400. // Pretty-print the response data.
  4401. fmt.Println(resp)
  4402. }
  4403. func ExampleEC2_ImportImage() {
  4404. sess, err := session.NewSession()
  4405. if err != nil {
  4406. fmt.Println("failed to create session,", err)
  4407. return
  4408. }
  4409. svc := ec2.New(sess)
  4410. params := &ec2.ImportImageInput{
  4411. Architecture: aws.String("String"),
  4412. ClientData: &ec2.ClientData{
  4413. Comment: aws.String("String"),
  4414. UploadEnd: aws.Time(time.Now()),
  4415. UploadSize: aws.Float64(1.0),
  4416. UploadStart: aws.Time(time.Now()),
  4417. },
  4418. ClientToken: aws.String("String"),
  4419. Description: aws.String("String"),
  4420. DiskContainers: []*ec2.ImageDiskContainer{
  4421. { // Required
  4422. Description: aws.String("String"),
  4423. DeviceName: aws.String("String"),
  4424. Format: aws.String("String"),
  4425. SnapshotId: aws.String("String"),
  4426. Url: aws.String("String"),
  4427. UserBucket: &ec2.UserBucket{
  4428. S3Bucket: aws.String("String"),
  4429. S3Key: aws.String("String"),
  4430. },
  4431. },
  4432. // More values...
  4433. },
  4434. DryRun: aws.Bool(true),
  4435. Hypervisor: aws.String("String"),
  4436. LicenseType: aws.String("String"),
  4437. Platform: aws.String("String"),
  4438. RoleName: aws.String("String"),
  4439. }
  4440. resp, err := svc.ImportImage(params)
  4441. if err != nil {
  4442. // Print the error, cast err to awserr.Error to get the Code and
  4443. // Message from an error.
  4444. fmt.Println(err.Error())
  4445. return
  4446. }
  4447. // Pretty-print the response data.
  4448. fmt.Println(resp)
  4449. }
  4450. func ExampleEC2_ImportInstance() {
  4451. sess, err := session.NewSession()
  4452. if err != nil {
  4453. fmt.Println("failed to create session,", err)
  4454. return
  4455. }
  4456. svc := ec2.New(sess)
  4457. params := &ec2.ImportInstanceInput{
  4458. Platform: aws.String("PlatformValues"), // Required
  4459. Description: aws.String("String"),
  4460. DiskImages: []*ec2.DiskImage{
  4461. { // Required
  4462. Description: aws.String("String"),
  4463. Image: &ec2.DiskImageDetail{
  4464. Bytes: aws.Int64(1), // Required
  4465. Format: aws.String("DiskImageFormat"), // Required
  4466. ImportManifestUrl: aws.String("String"), // Required
  4467. },
  4468. Volume: &ec2.VolumeDetail{
  4469. Size: aws.Int64(1), // Required
  4470. },
  4471. },
  4472. // More values...
  4473. },
  4474. DryRun: aws.Bool(true),
  4475. LaunchSpecification: &ec2.ImportInstanceLaunchSpecification{
  4476. AdditionalInfo: aws.String("String"),
  4477. Architecture: aws.String("ArchitectureValues"),
  4478. GroupIds: []*string{
  4479. aws.String("String"), // Required
  4480. // More values...
  4481. },
  4482. GroupNames: []*string{
  4483. aws.String("String"), // Required
  4484. // More values...
  4485. },
  4486. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  4487. InstanceType: aws.String("InstanceType"),
  4488. Monitoring: aws.Bool(true),
  4489. Placement: &ec2.Placement{
  4490. Affinity: aws.String("String"),
  4491. AvailabilityZone: aws.String("String"),
  4492. GroupName: aws.String("String"),
  4493. HostId: aws.String("String"),
  4494. Tenancy: aws.String("Tenancy"),
  4495. },
  4496. PrivateIpAddress: aws.String("String"),
  4497. SubnetId: aws.String("String"),
  4498. UserData: &ec2.UserData{
  4499. Data: aws.String("String"),
  4500. },
  4501. },
  4502. }
  4503. resp, err := svc.ImportInstance(params)
  4504. if err != nil {
  4505. // Print the error, cast err to awserr.Error to get the Code and
  4506. // Message from an error.
  4507. fmt.Println(err.Error())
  4508. return
  4509. }
  4510. // Pretty-print the response data.
  4511. fmt.Println(resp)
  4512. }
  4513. func ExampleEC2_ImportKeyPair() {
  4514. sess, err := session.NewSession()
  4515. if err != nil {
  4516. fmt.Println("failed to create session,", err)
  4517. return
  4518. }
  4519. svc := ec2.New(sess)
  4520. params := &ec2.ImportKeyPairInput{
  4521. KeyName: aws.String("String"), // Required
  4522. PublicKeyMaterial: []byte("PAYLOAD"), // Required
  4523. DryRun: aws.Bool(true),
  4524. }
  4525. resp, err := svc.ImportKeyPair(params)
  4526. if err != nil {
  4527. // Print the error, cast err to awserr.Error to get the Code and
  4528. // Message from an error.
  4529. fmt.Println(err.Error())
  4530. return
  4531. }
  4532. // Pretty-print the response data.
  4533. fmt.Println(resp)
  4534. }
  4535. func ExampleEC2_ImportSnapshot() {
  4536. sess, err := session.NewSession()
  4537. if err != nil {
  4538. fmt.Println("failed to create session,", err)
  4539. return
  4540. }
  4541. svc := ec2.New(sess)
  4542. params := &ec2.ImportSnapshotInput{
  4543. ClientData: &ec2.ClientData{
  4544. Comment: aws.String("String"),
  4545. UploadEnd: aws.Time(time.Now()),
  4546. UploadSize: aws.Float64(1.0),
  4547. UploadStart: aws.Time(time.Now()),
  4548. },
  4549. ClientToken: aws.String("String"),
  4550. Description: aws.String("String"),
  4551. DiskContainer: &ec2.SnapshotDiskContainer{
  4552. Description: aws.String("String"),
  4553. Format: aws.String("String"),
  4554. Url: aws.String("String"),
  4555. UserBucket: &ec2.UserBucket{
  4556. S3Bucket: aws.String("String"),
  4557. S3Key: aws.String("String"),
  4558. },
  4559. },
  4560. DryRun: aws.Bool(true),
  4561. RoleName: aws.String("String"),
  4562. }
  4563. resp, err := svc.ImportSnapshot(params)
  4564. if err != nil {
  4565. // Print the error, cast err to awserr.Error to get the Code and
  4566. // Message from an error.
  4567. fmt.Println(err.Error())
  4568. return
  4569. }
  4570. // Pretty-print the response data.
  4571. fmt.Println(resp)
  4572. }
  4573. func ExampleEC2_ImportVolume() {
  4574. sess, err := session.NewSession()
  4575. if err != nil {
  4576. fmt.Println("failed to create session,", err)
  4577. return
  4578. }
  4579. svc := ec2.New(sess)
  4580. params := &ec2.ImportVolumeInput{
  4581. AvailabilityZone: aws.String("String"), // Required
  4582. Image: &ec2.DiskImageDetail{ // Required
  4583. Bytes: aws.Int64(1), // Required
  4584. Format: aws.String("DiskImageFormat"), // Required
  4585. ImportManifestUrl: aws.String("String"), // Required
  4586. },
  4587. Volume: &ec2.VolumeDetail{ // Required
  4588. Size: aws.Int64(1), // Required
  4589. },
  4590. Description: aws.String("String"),
  4591. DryRun: aws.Bool(true),
  4592. }
  4593. resp, err := svc.ImportVolume(params)
  4594. if err != nil {
  4595. // Print the error, cast err to awserr.Error to get the Code and
  4596. // Message from an error.
  4597. fmt.Println(err.Error())
  4598. return
  4599. }
  4600. // Pretty-print the response data.
  4601. fmt.Println(resp)
  4602. }
  4603. func ExampleEC2_ModifyHosts() {
  4604. sess, err := session.NewSession()
  4605. if err != nil {
  4606. fmt.Println("failed to create session,", err)
  4607. return
  4608. }
  4609. svc := ec2.New(sess)
  4610. params := &ec2.ModifyHostsInput{
  4611. AutoPlacement: aws.String("AutoPlacement"), // Required
  4612. HostIds: []*string{ // Required
  4613. aws.String("String"), // Required
  4614. // More values...
  4615. },
  4616. }
  4617. resp, err := svc.ModifyHosts(params)
  4618. if err != nil {
  4619. // Print the error, cast err to awserr.Error to get the Code and
  4620. // Message from an error.
  4621. fmt.Println(err.Error())
  4622. return
  4623. }
  4624. // Pretty-print the response data.
  4625. fmt.Println(resp)
  4626. }
  4627. func ExampleEC2_ModifyIdFormat() {
  4628. sess, err := session.NewSession()
  4629. if err != nil {
  4630. fmt.Println("failed to create session,", err)
  4631. return
  4632. }
  4633. svc := ec2.New(sess)
  4634. params := &ec2.ModifyIdFormatInput{
  4635. Resource: aws.String("String"), // Required
  4636. UseLongIds: aws.Bool(true), // Required
  4637. }
  4638. resp, err := svc.ModifyIdFormat(params)
  4639. if err != nil {
  4640. // Print the error, cast err to awserr.Error to get the Code and
  4641. // Message from an error.
  4642. fmt.Println(err.Error())
  4643. return
  4644. }
  4645. // Pretty-print the response data.
  4646. fmt.Println(resp)
  4647. }
  4648. func ExampleEC2_ModifyIdentityIdFormat() {
  4649. sess, err := session.NewSession()
  4650. if err != nil {
  4651. fmt.Println("failed to create session,", err)
  4652. return
  4653. }
  4654. svc := ec2.New(sess)
  4655. params := &ec2.ModifyIdentityIdFormatInput{
  4656. PrincipalArn: aws.String("String"), // Required
  4657. Resource: aws.String("String"), // Required
  4658. UseLongIds: aws.Bool(true), // Required
  4659. }
  4660. resp, err := svc.ModifyIdentityIdFormat(params)
  4661. if err != nil {
  4662. // Print the error, cast err to awserr.Error to get the Code and
  4663. // Message from an error.
  4664. fmt.Println(err.Error())
  4665. return
  4666. }
  4667. // Pretty-print the response data.
  4668. fmt.Println(resp)
  4669. }
  4670. func ExampleEC2_ModifyImageAttribute() {
  4671. sess, err := session.NewSession()
  4672. if err != nil {
  4673. fmt.Println("failed to create session,", err)
  4674. return
  4675. }
  4676. svc := ec2.New(sess)
  4677. params := &ec2.ModifyImageAttributeInput{
  4678. ImageId: aws.String("String"), // Required
  4679. Attribute: aws.String("String"),
  4680. Description: &ec2.AttributeValue{
  4681. Value: aws.String("String"),
  4682. },
  4683. DryRun: aws.Bool(true),
  4684. LaunchPermission: &ec2.LaunchPermissionModifications{
  4685. Add: []*ec2.LaunchPermission{
  4686. { // Required
  4687. Group: aws.String("PermissionGroup"),
  4688. UserId: aws.String("String"),
  4689. },
  4690. // More values...
  4691. },
  4692. Remove: []*ec2.LaunchPermission{
  4693. { // Required
  4694. Group: aws.String("PermissionGroup"),
  4695. UserId: aws.String("String"),
  4696. },
  4697. // More values...
  4698. },
  4699. },
  4700. OperationType: aws.String("OperationType"),
  4701. ProductCodes: []*string{
  4702. aws.String("String"), // Required
  4703. // More values...
  4704. },
  4705. UserGroups: []*string{
  4706. aws.String("String"), // Required
  4707. // More values...
  4708. },
  4709. UserIds: []*string{
  4710. aws.String("String"), // Required
  4711. // More values...
  4712. },
  4713. Value: aws.String("String"),
  4714. }
  4715. resp, err := svc.ModifyImageAttribute(params)
  4716. if err != nil {
  4717. // Print the error, cast err to awserr.Error to get the Code and
  4718. // Message from an error.
  4719. fmt.Println(err.Error())
  4720. return
  4721. }
  4722. // Pretty-print the response data.
  4723. fmt.Println(resp)
  4724. }
  4725. func ExampleEC2_ModifyInstanceAttribute() {
  4726. sess, err := session.NewSession()
  4727. if err != nil {
  4728. fmt.Println("failed to create session,", err)
  4729. return
  4730. }
  4731. svc := ec2.New(sess)
  4732. params := &ec2.ModifyInstanceAttributeInput{
  4733. InstanceId: aws.String("String"), // Required
  4734. Attribute: aws.String("InstanceAttributeName"),
  4735. BlockDeviceMappings: []*ec2.InstanceBlockDeviceMappingSpecification{
  4736. { // Required
  4737. DeviceName: aws.String("String"),
  4738. Ebs: &ec2.EbsInstanceBlockDeviceSpecification{
  4739. DeleteOnTermination: aws.Bool(true),
  4740. VolumeId: aws.String("String"),
  4741. },
  4742. NoDevice: aws.String("String"),
  4743. VirtualName: aws.String("String"),
  4744. },
  4745. // More values...
  4746. },
  4747. DisableApiTermination: &ec2.AttributeBooleanValue{
  4748. Value: aws.Bool(true),
  4749. },
  4750. DryRun: aws.Bool(true),
  4751. EbsOptimized: &ec2.AttributeBooleanValue{
  4752. Value: aws.Bool(true),
  4753. },
  4754. EnaSupport: &ec2.AttributeBooleanValue{
  4755. Value: aws.Bool(true),
  4756. },
  4757. Groups: []*string{
  4758. aws.String("String"), // Required
  4759. // More values...
  4760. },
  4761. InstanceInitiatedShutdownBehavior: &ec2.AttributeValue{
  4762. Value: aws.String("String"),
  4763. },
  4764. InstanceType: &ec2.AttributeValue{
  4765. Value: aws.String("String"),
  4766. },
  4767. Kernel: &ec2.AttributeValue{
  4768. Value: aws.String("String"),
  4769. },
  4770. Ramdisk: &ec2.AttributeValue{
  4771. Value: aws.String("String"),
  4772. },
  4773. SourceDestCheck: &ec2.AttributeBooleanValue{
  4774. Value: aws.Bool(true),
  4775. },
  4776. SriovNetSupport: &ec2.AttributeValue{
  4777. Value: aws.String("String"),
  4778. },
  4779. UserData: &ec2.BlobAttributeValue{
  4780. Value: []byte("PAYLOAD"),
  4781. },
  4782. Value: aws.String("String"),
  4783. }
  4784. resp, err := svc.ModifyInstanceAttribute(params)
  4785. if err != nil {
  4786. // Print the error, cast err to awserr.Error to get the Code and
  4787. // Message from an error.
  4788. fmt.Println(err.Error())
  4789. return
  4790. }
  4791. // Pretty-print the response data.
  4792. fmt.Println(resp)
  4793. }
  4794. func ExampleEC2_ModifyInstancePlacement() {
  4795. sess, err := session.NewSession()
  4796. if err != nil {
  4797. fmt.Println("failed to create session,", err)
  4798. return
  4799. }
  4800. svc := ec2.New(sess)
  4801. params := &ec2.ModifyInstancePlacementInput{
  4802. InstanceId: aws.String("String"), // Required
  4803. Affinity: aws.String("Affinity"),
  4804. HostId: aws.String("String"),
  4805. Tenancy: aws.String("HostTenancy"),
  4806. }
  4807. resp, err := svc.ModifyInstancePlacement(params)
  4808. if err != nil {
  4809. // Print the error, cast err to awserr.Error to get the Code and
  4810. // Message from an error.
  4811. fmt.Println(err.Error())
  4812. return
  4813. }
  4814. // Pretty-print the response data.
  4815. fmt.Println(resp)
  4816. }
  4817. func ExampleEC2_ModifyNetworkInterfaceAttribute() {
  4818. sess, err := session.NewSession()
  4819. if err != nil {
  4820. fmt.Println("failed to create session,", err)
  4821. return
  4822. }
  4823. svc := ec2.New(sess)
  4824. params := &ec2.ModifyNetworkInterfaceAttributeInput{
  4825. NetworkInterfaceId: aws.String("String"), // Required
  4826. Attachment: &ec2.NetworkInterfaceAttachmentChanges{
  4827. AttachmentId: aws.String("String"),
  4828. DeleteOnTermination: aws.Bool(true),
  4829. },
  4830. Description: &ec2.AttributeValue{
  4831. Value: aws.String("String"),
  4832. },
  4833. DryRun: aws.Bool(true),
  4834. Groups: []*string{
  4835. aws.String("String"), // Required
  4836. // More values...
  4837. },
  4838. SourceDestCheck: &ec2.AttributeBooleanValue{
  4839. Value: aws.Bool(true),
  4840. },
  4841. }
  4842. resp, err := svc.ModifyNetworkInterfaceAttribute(params)
  4843. if err != nil {
  4844. // Print the error, cast err to awserr.Error to get the Code and
  4845. // Message from an error.
  4846. fmt.Println(err.Error())
  4847. return
  4848. }
  4849. // Pretty-print the response data.
  4850. fmt.Println(resp)
  4851. }
  4852. func ExampleEC2_ModifyReservedInstances() {
  4853. sess, err := session.NewSession()
  4854. if err != nil {
  4855. fmt.Println("failed to create session,", err)
  4856. return
  4857. }
  4858. svc := ec2.New(sess)
  4859. params := &ec2.ModifyReservedInstancesInput{
  4860. ReservedInstancesIds: []*string{ // Required
  4861. aws.String("String"), // Required
  4862. // More values...
  4863. },
  4864. TargetConfigurations: []*ec2.ReservedInstancesConfiguration{ // Required
  4865. { // Required
  4866. AvailabilityZone: aws.String("String"),
  4867. InstanceCount: aws.Int64(1),
  4868. InstanceType: aws.String("InstanceType"),
  4869. Platform: aws.String("String"),
  4870. Scope: aws.String("scope"),
  4871. },
  4872. // More values...
  4873. },
  4874. ClientToken: aws.String("String"),
  4875. }
  4876. resp, err := svc.ModifyReservedInstances(params)
  4877. if err != nil {
  4878. // Print the error, cast err to awserr.Error to get the Code and
  4879. // Message from an error.
  4880. fmt.Println(err.Error())
  4881. return
  4882. }
  4883. // Pretty-print the response data.
  4884. fmt.Println(resp)
  4885. }
  4886. func ExampleEC2_ModifySnapshotAttribute() {
  4887. sess, err := session.NewSession()
  4888. if err != nil {
  4889. fmt.Println("failed to create session,", err)
  4890. return
  4891. }
  4892. svc := ec2.New(sess)
  4893. params := &ec2.ModifySnapshotAttributeInput{
  4894. SnapshotId: aws.String("String"), // Required
  4895. Attribute: aws.String("SnapshotAttributeName"),
  4896. CreateVolumePermission: &ec2.CreateVolumePermissionModifications{
  4897. Add: []*ec2.CreateVolumePermission{
  4898. { // Required
  4899. Group: aws.String("PermissionGroup"),
  4900. UserId: aws.String("String"),
  4901. },
  4902. // More values...
  4903. },
  4904. Remove: []*ec2.CreateVolumePermission{
  4905. { // Required
  4906. Group: aws.String("PermissionGroup"),
  4907. UserId: aws.String("String"),
  4908. },
  4909. // More values...
  4910. },
  4911. },
  4912. DryRun: aws.Bool(true),
  4913. GroupNames: []*string{
  4914. aws.String("String"), // Required
  4915. // More values...
  4916. },
  4917. OperationType: aws.String("OperationType"),
  4918. UserIds: []*string{
  4919. aws.String("String"), // Required
  4920. // More values...
  4921. },
  4922. }
  4923. resp, err := svc.ModifySnapshotAttribute(params)
  4924. if err != nil {
  4925. // Print the error, cast err to awserr.Error to get the Code and
  4926. // Message from an error.
  4927. fmt.Println(err.Error())
  4928. return
  4929. }
  4930. // Pretty-print the response data.
  4931. fmt.Println(resp)
  4932. }
  4933. func ExampleEC2_ModifySpotFleetRequest() {
  4934. sess, err := session.NewSession()
  4935. if err != nil {
  4936. fmt.Println("failed to create session,", err)
  4937. return
  4938. }
  4939. svc := ec2.New(sess)
  4940. params := &ec2.ModifySpotFleetRequestInput{
  4941. SpotFleetRequestId: aws.String("String"), // Required
  4942. ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"),
  4943. TargetCapacity: aws.Int64(1),
  4944. }
  4945. resp, err := svc.ModifySpotFleetRequest(params)
  4946. if err != nil {
  4947. // Print the error, cast err to awserr.Error to get the Code and
  4948. // Message from an error.
  4949. fmt.Println(err.Error())
  4950. return
  4951. }
  4952. // Pretty-print the response data.
  4953. fmt.Println(resp)
  4954. }
  4955. func ExampleEC2_ModifySubnetAttribute() {
  4956. sess, err := session.NewSession()
  4957. if err != nil {
  4958. fmt.Println("failed to create session,", err)
  4959. return
  4960. }
  4961. svc := ec2.New(sess)
  4962. params := &ec2.ModifySubnetAttributeInput{
  4963. SubnetId: aws.String("String"), // Required
  4964. MapPublicIpOnLaunch: &ec2.AttributeBooleanValue{
  4965. Value: aws.Bool(true),
  4966. },
  4967. }
  4968. resp, err := svc.ModifySubnetAttribute(params)
  4969. if err != nil {
  4970. // Print the error, cast err to awserr.Error to get the Code and
  4971. // Message from an error.
  4972. fmt.Println(err.Error())
  4973. return
  4974. }
  4975. // Pretty-print the response data.
  4976. fmt.Println(resp)
  4977. }
  4978. func ExampleEC2_ModifyVolumeAttribute() {
  4979. sess, err := session.NewSession()
  4980. if err != nil {
  4981. fmt.Println("failed to create session,", err)
  4982. return
  4983. }
  4984. svc := ec2.New(sess)
  4985. params := &ec2.ModifyVolumeAttributeInput{
  4986. VolumeId: aws.String("String"), // Required
  4987. AutoEnableIO: &ec2.AttributeBooleanValue{
  4988. Value: aws.Bool(true),
  4989. },
  4990. DryRun: aws.Bool(true),
  4991. }
  4992. resp, err := svc.ModifyVolumeAttribute(params)
  4993. if err != nil {
  4994. // Print the error, cast err to awserr.Error to get the Code and
  4995. // Message from an error.
  4996. fmt.Println(err.Error())
  4997. return
  4998. }
  4999. // Pretty-print the response data.
  5000. fmt.Println(resp)
  5001. }
  5002. func ExampleEC2_ModifyVpcAttribute() {
  5003. sess, err := session.NewSession()
  5004. if err != nil {
  5005. fmt.Println("failed to create session,", err)
  5006. return
  5007. }
  5008. svc := ec2.New(sess)
  5009. params := &ec2.ModifyVpcAttributeInput{
  5010. VpcId: aws.String("String"), // Required
  5011. EnableDnsHostnames: &ec2.AttributeBooleanValue{
  5012. Value: aws.Bool(true),
  5013. },
  5014. EnableDnsSupport: &ec2.AttributeBooleanValue{
  5015. Value: aws.Bool(true),
  5016. },
  5017. }
  5018. resp, err := svc.ModifyVpcAttribute(params)
  5019. if err != nil {
  5020. // Print the error, cast err to awserr.Error to get the Code and
  5021. // Message from an error.
  5022. fmt.Println(err.Error())
  5023. return
  5024. }
  5025. // Pretty-print the response data.
  5026. fmt.Println(resp)
  5027. }
  5028. func ExampleEC2_ModifyVpcEndpoint() {
  5029. sess, err := session.NewSession()
  5030. if err != nil {
  5031. fmt.Println("failed to create session,", err)
  5032. return
  5033. }
  5034. svc := ec2.New(sess)
  5035. params := &ec2.ModifyVpcEndpointInput{
  5036. VpcEndpointId: aws.String("String"), // Required
  5037. AddRouteTableIds: []*string{
  5038. aws.String("String"), // Required
  5039. // More values...
  5040. },
  5041. DryRun: aws.Bool(true),
  5042. PolicyDocument: aws.String("String"),
  5043. RemoveRouteTableIds: []*string{
  5044. aws.String("String"), // Required
  5045. // More values...
  5046. },
  5047. ResetPolicy: aws.Bool(true),
  5048. }
  5049. resp, err := svc.ModifyVpcEndpoint(params)
  5050. if err != nil {
  5051. // Print the error, cast err to awserr.Error to get the Code and
  5052. // Message from an error.
  5053. fmt.Println(err.Error())
  5054. return
  5055. }
  5056. // Pretty-print the response data.
  5057. fmt.Println(resp)
  5058. }
  5059. func ExampleEC2_ModifyVpcPeeringConnectionOptions() {
  5060. sess, err := session.NewSession()
  5061. if err != nil {
  5062. fmt.Println("failed to create session,", err)
  5063. return
  5064. }
  5065. svc := ec2.New(sess)
  5066. params := &ec2.ModifyVpcPeeringConnectionOptionsInput{
  5067. VpcPeeringConnectionId: aws.String("String"), // Required
  5068. AccepterPeeringConnectionOptions: &ec2.PeeringConnectionOptionsRequest{
  5069. AllowDnsResolutionFromRemoteVpc: aws.Bool(true),
  5070. AllowEgressFromLocalClassicLinkToRemoteVpc: aws.Bool(true),
  5071. AllowEgressFromLocalVpcToRemoteClassicLink: aws.Bool(true),
  5072. },
  5073. DryRun: aws.Bool(true),
  5074. RequesterPeeringConnectionOptions: &ec2.PeeringConnectionOptionsRequest{
  5075. AllowDnsResolutionFromRemoteVpc: aws.Bool(true),
  5076. AllowEgressFromLocalClassicLinkToRemoteVpc: aws.Bool(true),
  5077. AllowEgressFromLocalVpcToRemoteClassicLink: aws.Bool(true),
  5078. },
  5079. }
  5080. resp, err := svc.ModifyVpcPeeringConnectionOptions(params)
  5081. if err != nil {
  5082. // Print the error, cast err to awserr.Error to get the Code and
  5083. // Message from an error.
  5084. fmt.Println(err.Error())
  5085. return
  5086. }
  5087. // Pretty-print the response data.
  5088. fmt.Println(resp)
  5089. }
  5090. func ExampleEC2_MonitorInstances() {
  5091. sess, err := session.NewSession()
  5092. if err != nil {
  5093. fmt.Println("failed to create session,", err)
  5094. return
  5095. }
  5096. svc := ec2.New(sess)
  5097. params := &ec2.MonitorInstancesInput{
  5098. InstanceIds: []*string{ // Required
  5099. aws.String("String"), // Required
  5100. // More values...
  5101. },
  5102. DryRun: aws.Bool(true),
  5103. }
  5104. resp, err := svc.MonitorInstances(params)
  5105. if err != nil {
  5106. // Print the error, cast err to awserr.Error to get the Code and
  5107. // Message from an error.
  5108. fmt.Println(err.Error())
  5109. return
  5110. }
  5111. // Pretty-print the response data.
  5112. fmt.Println(resp)
  5113. }
  5114. func ExampleEC2_MoveAddressToVpc() {
  5115. sess, err := session.NewSession()
  5116. if err != nil {
  5117. fmt.Println("failed to create session,", err)
  5118. return
  5119. }
  5120. svc := ec2.New(sess)
  5121. params := &ec2.MoveAddressToVpcInput{
  5122. PublicIp: aws.String("String"), // Required
  5123. DryRun: aws.Bool(true),
  5124. }
  5125. resp, err := svc.MoveAddressToVpc(params)
  5126. if err != nil {
  5127. // Print the error, cast err to awserr.Error to get the Code and
  5128. // Message from an error.
  5129. fmt.Println(err.Error())
  5130. return
  5131. }
  5132. // Pretty-print the response data.
  5133. fmt.Println(resp)
  5134. }
  5135. func ExampleEC2_PurchaseHostReservation() {
  5136. sess, err := session.NewSession()
  5137. if err != nil {
  5138. fmt.Println("failed to create session,", err)
  5139. return
  5140. }
  5141. svc := ec2.New(sess)
  5142. params := &ec2.PurchaseHostReservationInput{
  5143. HostIdSet: []*string{ // Required
  5144. aws.String("String"), // Required
  5145. // More values...
  5146. },
  5147. OfferingId: aws.String("String"), // Required
  5148. ClientToken: aws.String("String"),
  5149. CurrencyCode: aws.String("CurrencyCodeValues"),
  5150. LimitPrice: aws.String("String"),
  5151. }
  5152. resp, err := svc.PurchaseHostReservation(params)
  5153. if err != nil {
  5154. // Print the error, cast err to awserr.Error to get the Code and
  5155. // Message from an error.
  5156. fmt.Println(err.Error())
  5157. return
  5158. }
  5159. // Pretty-print the response data.
  5160. fmt.Println(resp)
  5161. }
  5162. func ExampleEC2_PurchaseReservedInstancesOffering() {
  5163. sess, err := session.NewSession()
  5164. if err != nil {
  5165. fmt.Println("failed to create session,", err)
  5166. return
  5167. }
  5168. svc := ec2.New(sess)
  5169. params := &ec2.PurchaseReservedInstancesOfferingInput{
  5170. InstanceCount: aws.Int64(1), // Required
  5171. ReservedInstancesOfferingId: aws.String("String"), // Required
  5172. DryRun: aws.Bool(true),
  5173. LimitPrice: &ec2.ReservedInstanceLimitPrice{
  5174. Amount: aws.Float64(1.0),
  5175. CurrencyCode: aws.String("CurrencyCodeValues"),
  5176. },
  5177. }
  5178. resp, err := svc.PurchaseReservedInstancesOffering(params)
  5179. if err != nil {
  5180. // Print the error, cast err to awserr.Error to get the Code and
  5181. // Message from an error.
  5182. fmt.Println(err.Error())
  5183. return
  5184. }
  5185. // Pretty-print the response data.
  5186. fmt.Println(resp)
  5187. }
  5188. func ExampleEC2_PurchaseScheduledInstances() {
  5189. sess, err := session.NewSession()
  5190. if err != nil {
  5191. fmt.Println("failed to create session,", err)
  5192. return
  5193. }
  5194. svc := ec2.New(sess)
  5195. params := &ec2.PurchaseScheduledInstancesInput{
  5196. PurchaseRequests: []*ec2.PurchaseRequest{ // Required
  5197. { // Required
  5198. InstanceCount: aws.Int64(1), // Required
  5199. PurchaseToken: aws.String("String"), // Required
  5200. },
  5201. // More values...
  5202. },
  5203. ClientToken: aws.String("String"),
  5204. DryRun: aws.Bool(true),
  5205. }
  5206. resp, err := svc.PurchaseScheduledInstances(params)
  5207. if err != nil {
  5208. // Print the error, cast err to awserr.Error to get the Code and
  5209. // Message from an error.
  5210. fmt.Println(err.Error())
  5211. return
  5212. }
  5213. // Pretty-print the response data.
  5214. fmt.Println(resp)
  5215. }
  5216. func ExampleEC2_RebootInstances() {
  5217. sess, err := session.NewSession()
  5218. if err != nil {
  5219. fmt.Println("failed to create session,", err)
  5220. return
  5221. }
  5222. svc := ec2.New(sess)
  5223. params := &ec2.RebootInstancesInput{
  5224. InstanceIds: []*string{ // Required
  5225. aws.String("String"), // Required
  5226. // More values...
  5227. },
  5228. DryRun: aws.Bool(true),
  5229. }
  5230. resp, err := svc.RebootInstances(params)
  5231. if err != nil {
  5232. // Print the error, cast err to awserr.Error to get the Code and
  5233. // Message from an error.
  5234. fmt.Println(err.Error())
  5235. return
  5236. }
  5237. // Pretty-print the response data.
  5238. fmt.Println(resp)
  5239. }
  5240. func ExampleEC2_RegisterImage() {
  5241. sess, err := session.NewSession()
  5242. if err != nil {
  5243. fmt.Println("failed to create session,", err)
  5244. return
  5245. }
  5246. svc := ec2.New(sess)
  5247. params := &ec2.RegisterImageInput{
  5248. Name: aws.String("String"), // Required
  5249. Architecture: aws.String("ArchitectureValues"),
  5250. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5251. { // Required
  5252. DeviceName: aws.String("String"),
  5253. Ebs: &ec2.EbsBlockDevice{
  5254. DeleteOnTermination: aws.Bool(true),
  5255. Encrypted: aws.Bool(true),
  5256. Iops: aws.Int64(1),
  5257. SnapshotId: aws.String("String"),
  5258. VolumeSize: aws.Int64(1),
  5259. VolumeType: aws.String("VolumeType"),
  5260. },
  5261. NoDevice: aws.String("String"),
  5262. VirtualName: aws.String("String"),
  5263. },
  5264. // More values...
  5265. },
  5266. Description: aws.String("String"),
  5267. DryRun: aws.Bool(true),
  5268. EnaSupport: aws.Bool(true),
  5269. ImageLocation: aws.String("String"),
  5270. KernelId: aws.String("String"),
  5271. RamdiskId: aws.String("String"),
  5272. RootDeviceName: aws.String("String"),
  5273. SriovNetSupport: aws.String("String"),
  5274. VirtualizationType: aws.String("String"),
  5275. }
  5276. resp, err := svc.RegisterImage(params)
  5277. if err != nil {
  5278. // Print the error, cast err to awserr.Error to get the Code and
  5279. // Message from an error.
  5280. fmt.Println(err.Error())
  5281. return
  5282. }
  5283. // Pretty-print the response data.
  5284. fmt.Println(resp)
  5285. }
  5286. func ExampleEC2_RejectVpcPeeringConnection() {
  5287. sess, err := session.NewSession()
  5288. if err != nil {
  5289. fmt.Println("failed to create session,", err)
  5290. return
  5291. }
  5292. svc := ec2.New(sess)
  5293. params := &ec2.RejectVpcPeeringConnectionInput{
  5294. VpcPeeringConnectionId: aws.String("String"), // Required
  5295. DryRun: aws.Bool(true),
  5296. }
  5297. resp, err := svc.RejectVpcPeeringConnection(params)
  5298. if err != nil {
  5299. // Print the error, cast err to awserr.Error to get the Code and
  5300. // Message from an error.
  5301. fmt.Println(err.Error())
  5302. return
  5303. }
  5304. // Pretty-print the response data.
  5305. fmt.Println(resp)
  5306. }
  5307. func ExampleEC2_ReleaseAddress() {
  5308. sess, err := session.NewSession()
  5309. if err != nil {
  5310. fmt.Println("failed to create session,", err)
  5311. return
  5312. }
  5313. svc := ec2.New(sess)
  5314. params := &ec2.ReleaseAddressInput{
  5315. AllocationId: aws.String("String"),
  5316. DryRun: aws.Bool(true),
  5317. PublicIp: aws.String("String"),
  5318. }
  5319. resp, err := svc.ReleaseAddress(params)
  5320. if err != nil {
  5321. // Print the error, cast err to awserr.Error to get the Code and
  5322. // Message from an error.
  5323. fmt.Println(err.Error())
  5324. return
  5325. }
  5326. // Pretty-print the response data.
  5327. fmt.Println(resp)
  5328. }
  5329. func ExampleEC2_ReleaseHosts() {
  5330. sess, err := session.NewSession()
  5331. if err != nil {
  5332. fmt.Println("failed to create session,", err)
  5333. return
  5334. }
  5335. svc := ec2.New(sess)
  5336. params := &ec2.ReleaseHostsInput{
  5337. HostIds: []*string{ // Required
  5338. aws.String("String"), // Required
  5339. // More values...
  5340. },
  5341. }
  5342. resp, err := svc.ReleaseHosts(params)
  5343. if err != nil {
  5344. // Print the error, cast err to awserr.Error to get the Code and
  5345. // Message from an error.
  5346. fmt.Println(err.Error())
  5347. return
  5348. }
  5349. // Pretty-print the response data.
  5350. fmt.Println(resp)
  5351. }
  5352. func ExampleEC2_ReplaceNetworkAclAssociation() {
  5353. sess, err := session.NewSession()
  5354. if err != nil {
  5355. fmt.Println("failed to create session,", err)
  5356. return
  5357. }
  5358. svc := ec2.New(sess)
  5359. params := &ec2.ReplaceNetworkAclAssociationInput{
  5360. AssociationId: aws.String("String"), // Required
  5361. NetworkAclId: aws.String("String"), // Required
  5362. DryRun: aws.Bool(true),
  5363. }
  5364. resp, err := svc.ReplaceNetworkAclAssociation(params)
  5365. if err != nil {
  5366. // Print the error, cast err to awserr.Error to get the Code and
  5367. // Message from an error.
  5368. fmt.Println(err.Error())
  5369. return
  5370. }
  5371. // Pretty-print the response data.
  5372. fmt.Println(resp)
  5373. }
  5374. func ExampleEC2_ReplaceNetworkAclEntry() {
  5375. sess, err := session.NewSession()
  5376. if err != nil {
  5377. fmt.Println("failed to create session,", err)
  5378. return
  5379. }
  5380. svc := ec2.New(sess)
  5381. params := &ec2.ReplaceNetworkAclEntryInput{
  5382. CidrBlock: aws.String("String"), // Required
  5383. Egress: aws.Bool(true), // Required
  5384. NetworkAclId: aws.String("String"), // Required
  5385. Protocol: aws.String("String"), // Required
  5386. RuleAction: aws.String("RuleAction"), // Required
  5387. RuleNumber: aws.Int64(1), // Required
  5388. DryRun: aws.Bool(true),
  5389. IcmpTypeCode: &ec2.IcmpTypeCode{
  5390. Code: aws.Int64(1),
  5391. Type: aws.Int64(1),
  5392. },
  5393. PortRange: &ec2.PortRange{
  5394. From: aws.Int64(1),
  5395. To: aws.Int64(1),
  5396. },
  5397. }
  5398. resp, err := svc.ReplaceNetworkAclEntry(params)
  5399. if err != nil {
  5400. // Print the error, cast err to awserr.Error to get the Code and
  5401. // Message from an error.
  5402. fmt.Println(err.Error())
  5403. return
  5404. }
  5405. // Pretty-print the response data.
  5406. fmt.Println(resp)
  5407. }
  5408. func ExampleEC2_ReplaceRoute() {
  5409. sess, err := session.NewSession()
  5410. if err != nil {
  5411. fmt.Println("failed to create session,", err)
  5412. return
  5413. }
  5414. svc := ec2.New(sess)
  5415. params := &ec2.ReplaceRouteInput{
  5416. DestinationCidrBlock: aws.String("String"), // Required
  5417. RouteTableId: aws.String("String"), // Required
  5418. DryRun: aws.Bool(true),
  5419. GatewayId: aws.String("String"),
  5420. InstanceId: aws.String("String"),
  5421. NatGatewayId: aws.String("String"),
  5422. NetworkInterfaceId: aws.String("String"),
  5423. VpcPeeringConnectionId: aws.String("String"),
  5424. }
  5425. resp, err := svc.ReplaceRoute(params)
  5426. if err != nil {
  5427. // Print the error, cast err to awserr.Error to get the Code and
  5428. // Message from an error.
  5429. fmt.Println(err.Error())
  5430. return
  5431. }
  5432. // Pretty-print the response data.
  5433. fmt.Println(resp)
  5434. }
  5435. func ExampleEC2_ReplaceRouteTableAssociation() {
  5436. sess, err := session.NewSession()
  5437. if err != nil {
  5438. fmt.Println("failed to create session,", err)
  5439. return
  5440. }
  5441. svc := ec2.New(sess)
  5442. params := &ec2.ReplaceRouteTableAssociationInput{
  5443. AssociationId: aws.String("String"), // Required
  5444. RouteTableId: aws.String("String"), // Required
  5445. DryRun: aws.Bool(true),
  5446. }
  5447. resp, err := svc.ReplaceRouteTableAssociation(params)
  5448. if err != nil {
  5449. // Print the error, cast err to awserr.Error to get the Code and
  5450. // Message from an error.
  5451. fmt.Println(err.Error())
  5452. return
  5453. }
  5454. // Pretty-print the response data.
  5455. fmt.Println(resp)
  5456. }
  5457. func ExampleEC2_ReportInstanceStatus() {
  5458. sess, err := session.NewSession()
  5459. if err != nil {
  5460. fmt.Println("failed to create session,", err)
  5461. return
  5462. }
  5463. svc := ec2.New(sess)
  5464. params := &ec2.ReportInstanceStatusInput{
  5465. Instances: []*string{ // Required
  5466. aws.String("String"), // Required
  5467. // More values...
  5468. },
  5469. ReasonCodes: []*string{ // Required
  5470. aws.String("ReportInstanceReasonCodes"), // Required
  5471. // More values...
  5472. },
  5473. Status: aws.String("ReportStatusType"), // Required
  5474. Description: aws.String("String"),
  5475. DryRun: aws.Bool(true),
  5476. EndTime: aws.Time(time.Now()),
  5477. StartTime: aws.Time(time.Now()),
  5478. }
  5479. resp, err := svc.ReportInstanceStatus(params)
  5480. if err != nil {
  5481. // Print the error, cast err to awserr.Error to get the Code and
  5482. // Message from an error.
  5483. fmt.Println(err.Error())
  5484. return
  5485. }
  5486. // Pretty-print the response data.
  5487. fmt.Println(resp)
  5488. }
  5489. func ExampleEC2_RequestSpotFleet() {
  5490. sess, err := session.NewSession()
  5491. if err != nil {
  5492. fmt.Println("failed to create session,", err)
  5493. return
  5494. }
  5495. svc := ec2.New(sess)
  5496. params := &ec2.RequestSpotFleetInput{
  5497. SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required
  5498. IamFleetRole: aws.String("String"), // Required
  5499. LaunchSpecifications: []*ec2.SpotFleetLaunchSpecification{ // Required
  5500. { // Required
  5501. AddressingType: aws.String("String"),
  5502. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5503. { // Required
  5504. DeviceName: aws.String("String"),
  5505. Ebs: &ec2.EbsBlockDevice{
  5506. DeleteOnTermination: aws.Bool(true),
  5507. Encrypted: aws.Bool(true),
  5508. Iops: aws.Int64(1),
  5509. SnapshotId: aws.String("String"),
  5510. VolumeSize: aws.Int64(1),
  5511. VolumeType: aws.String("VolumeType"),
  5512. },
  5513. NoDevice: aws.String("String"),
  5514. VirtualName: aws.String("String"),
  5515. },
  5516. // More values...
  5517. },
  5518. EbsOptimized: aws.Bool(true),
  5519. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5520. Arn: aws.String("String"),
  5521. Name: aws.String("String"),
  5522. },
  5523. ImageId: aws.String("String"),
  5524. InstanceType: aws.String("InstanceType"),
  5525. KernelId: aws.String("String"),
  5526. KeyName: aws.String("String"),
  5527. Monitoring: &ec2.SpotFleetMonitoring{
  5528. Enabled: aws.Bool(true),
  5529. },
  5530. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5531. { // Required
  5532. AssociatePublicIpAddress: aws.Bool(true),
  5533. DeleteOnTermination: aws.Bool(true),
  5534. Description: aws.String("String"),
  5535. DeviceIndex: aws.Int64(1),
  5536. Groups: []*string{
  5537. aws.String("String"), // Required
  5538. // More values...
  5539. },
  5540. NetworkInterfaceId: aws.String("String"),
  5541. PrivateIpAddress: aws.String("String"),
  5542. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5543. { // Required
  5544. PrivateIpAddress: aws.String("String"), // Required
  5545. Primary: aws.Bool(true),
  5546. },
  5547. // More values...
  5548. },
  5549. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5550. SubnetId: aws.String("String"),
  5551. },
  5552. // More values...
  5553. },
  5554. Placement: &ec2.SpotPlacement{
  5555. AvailabilityZone: aws.String("String"),
  5556. GroupName: aws.String("String"),
  5557. },
  5558. RamdiskId: aws.String("String"),
  5559. SecurityGroups: []*ec2.GroupIdentifier{
  5560. { // Required
  5561. GroupId: aws.String("String"),
  5562. GroupName: aws.String("String"),
  5563. },
  5564. // More values...
  5565. },
  5566. SpotPrice: aws.String("String"),
  5567. SubnetId: aws.String("String"),
  5568. UserData: aws.String("String"),
  5569. WeightedCapacity: aws.Float64(1.0),
  5570. },
  5571. // More values...
  5572. },
  5573. SpotPrice: aws.String("String"), // Required
  5574. TargetCapacity: aws.Int64(1), // Required
  5575. AllocationStrategy: aws.String("AllocationStrategy"),
  5576. ClientToken: aws.String("String"),
  5577. ExcessCapacityTerminationPolicy: aws.String("ExcessCapacityTerminationPolicy"),
  5578. FulfilledCapacity: aws.Float64(1.0),
  5579. TerminateInstancesWithExpiration: aws.Bool(true),
  5580. Type: aws.String("FleetType"),
  5581. ValidFrom: aws.Time(time.Now()),
  5582. ValidUntil: aws.Time(time.Now()),
  5583. },
  5584. DryRun: aws.Bool(true),
  5585. }
  5586. resp, err := svc.RequestSpotFleet(params)
  5587. if err != nil {
  5588. // Print the error, cast err to awserr.Error to get the Code and
  5589. // Message from an error.
  5590. fmt.Println(err.Error())
  5591. return
  5592. }
  5593. // Pretty-print the response data.
  5594. fmt.Println(resp)
  5595. }
  5596. func ExampleEC2_RequestSpotInstances() {
  5597. sess, err := session.NewSession()
  5598. if err != nil {
  5599. fmt.Println("failed to create session,", err)
  5600. return
  5601. }
  5602. svc := ec2.New(sess)
  5603. params := &ec2.RequestSpotInstancesInput{
  5604. SpotPrice: aws.String("String"), // Required
  5605. AvailabilityZoneGroup: aws.String("String"),
  5606. BlockDurationMinutes: aws.Int64(1),
  5607. ClientToken: aws.String("String"),
  5608. DryRun: aws.Bool(true),
  5609. InstanceCount: aws.Int64(1),
  5610. LaunchGroup: aws.String("String"),
  5611. LaunchSpecification: &ec2.RequestSpotLaunchSpecification{
  5612. AddressingType: aws.String("String"),
  5613. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5614. { // Required
  5615. DeviceName: aws.String("String"),
  5616. Ebs: &ec2.EbsBlockDevice{
  5617. DeleteOnTermination: aws.Bool(true),
  5618. Encrypted: aws.Bool(true),
  5619. Iops: aws.Int64(1),
  5620. SnapshotId: aws.String("String"),
  5621. VolumeSize: aws.Int64(1),
  5622. VolumeType: aws.String("VolumeType"),
  5623. },
  5624. NoDevice: aws.String("String"),
  5625. VirtualName: aws.String("String"),
  5626. },
  5627. // More values...
  5628. },
  5629. EbsOptimized: aws.Bool(true),
  5630. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5631. Arn: aws.String("String"),
  5632. Name: aws.String("String"),
  5633. },
  5634. ImageId: aws.String("String"),
  5635. InstanceType: aws.String("InstanceType"),
  5636. KernelId: aws.String("String"),
  5637. KeyName: aws.String("String"),
  5638. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  5639. Enabled: aws.Bool(true), // Required
  5640. },
  5641. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5642. { // Required
  5643. AssociatePublicIpAddress: aws.Bool(true),
  5644. DeleteOnTermination: aws.Bool(true),
  5645. Description: aws.String("String"),
  5646. DeviceIndex: aws.Int64(1),
  5647. Groups: []*string{
  5648. aws.String("String"), // Required
  5649. // More values...
  5650. },
  5651. NetworkInterfaceId: aws.String("String"),
  5652. PrivateIpAddress: aws.String("String"),
  5653. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5654. { // Required
  5655. PrivateIpAddress: aws.String("String"), // Required
  5656. Primary: aws.Bool(true),
  5657. },
  5658. // More values...
  5659. },
  5660. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5661. SubnetId: aws.String("String"),
  5662. },
  5663. // More values...
  5664. },
  5665. Placement: &ec2.SpotPlacement{
  5666. AvailabilityZone: aws.String("String"),
  5667. GroupName: aws.String("String"),
  5668. },
  5669. RamdiskId: aws.String("String"),
  5670. SecurityGroupIds: []*string{
  5671. aws.String("String"), // Required
  5672. // More values...
  5673. },
  5674. SecurityGroups: []*string{
  5675. aws.String("String"), // Required
  5676. // More values...
  5677. },
  5678. SubnetId: aws.String("String"),
  5679. UserData: aws.String("String"),
  5680. },
  5681. Type: aws.String("SpotInstanceType"),
  5682. ValidFrom: aws.Time(time.Now()),
  5683. ValidUntil: aws.Time(time.Now()),
  5684. }
  5685. resp, err := svc.RequestSpotInstances(params)
  5686. if err != nil {
  5687. // Print the error, cast err to awserr.Error to get the Code and
  5688. // Message from an error.
  5689. fmt.Println(err.Error())
  5690. return
  5691. }
  5692. // Pretty-print the response data.
  5693. fmt.Println(resp)
  5694. }
  5695. func ExampleEC2_ResetImageAttribute() {
  5696. sess, err := session.NewSession()
  5697. if err != nil {
  5698. fmt.Println("failed to create session,", err)
  5699. return
  5700. }
  5701. svc := ec2.New(sess)
  5702. params := &ec2.ResetImageAttributeInput{
  5703. Attribute: aws.String("ResetImageAttributeName"), // Required
  5704. ImageId: aws.String("String"), // Required
  5705. DryRun: aws.Bool(true),
  5706. }
  5707. resp, err := svc.ResetImageAttribute(params)
  5708. if err != nil {
  5709. // Print the error, cast err to awserr.Error to get the Code and
  5710. // Message from an error.
  5711. fmt.Println(err.Error())
  5712. return
  5713. }
  5714. // Pretty-print the response data.
  5715. fmt.Println(resp)
  5716. }
  5717. func ExampleEC2_ResetInstanceAttribute() {
  5718. sess, err := session.NewSession()
  5719. if err != nil {
  5720. fmt.Println("failed to create session,", err)
  5721. return
  5722. }
  5723. svc := ec2.New(sess)
  5724. params := &ec2.ResetInstanceAttributeInput{
  5725. Attribute: aws.String("InstanceAttributeName"), // Required
  5726. InstanceId: aws.String("String"), // Required
  5727. DryRun: aws.Bool(true),
  5728. }
  5729. resp, err := svc.ResetInstanceAttribute(params)
  5730. if err != nil {
  5731. // Print the error, cast err to awserr.Error to get the Code and
  5732. // Message from an error.
  5733. fmt.Println(err.Error())
  5734. return
  5735. }
  5736. // Pretty-print the response data.
  5737. fmt.Println(resp)
  5738. }
  5739. func ExampleEC2_ResetNetworkInterfaceAttribute() {
  5740. sess, err := session.NewSession()
  5741. if err != nil {
  5742. fmt.Println("failed to create session,", err)
  5743. return
  5744. }
  5745. svc := ec2.New(sess)
  5746. params := &ec2.ResetNetworkInterfaceAttributeInput{
  5747. NetworkInterfaceId: aws.String("String"), // Required
  5748. DryRun: aws.Bool(true),
  5749. SourceDestCheck: aws.String("String"),
  5750. }
  5751. resp, err := svc.ResetNetworkInterfaceAttribute(params)
  5752. if err != nil {
  5753. // Print the error, cast err to awserr.Error to get the Code and
  5754. // Message from an error.
  5755. fmt.Println(err.Error())
  5756. return
  5757. }
  5758. // Pretty-print the response data.
  5759. fmt.Println(resp)
  5760. }
  5761. func ExampleEC2_ResetSnapshotAttribute() {
  5762. sess, err := session.NewSession()
  5763. if err != nil {
  5764. fmt.Println("failed to create session,", err)
  5765. return
  5766. }
  5767. svc := ec2.New(sess)
  5768. params := &ec2.ResetSnapshotAttributeInput{
  5769. Attribute: aws.String("SnapshotAttributeName"), // Required
  5770. SnapshotId: aws.String("String"), // Required
  5771. DryRun: aws.Bool(true),
  5772. }
  5773. resp, err := svc.ResetSnapshotAttribute(params)
  5774. if err != nil {
  5775. // Print the error, cast err to awserr.Error to get the Code and
  5776. // Message from an error.
  5777. fmt.Println(err.Error())
  5778. return
  5779. }
  5780. // Pretty-print the response data.
  5781. fmt.Println(resp)
  5782. }
  5783. func ExampleEC2_RestoreAddressToClassic() {
  5784. sess, err := session.NewSession()
  5785. if err != nil {
  5786. fmt.Println("failed to create session,", err)
  5787. return
  5788. }
  5789. svc := ec2.New(sess)
  5790. params := &ec2.RestoreAddressToClassicInput{
  5791. PublicIp: aws.String("String"), // Required
  5792. DryRun: aws.Bool(true),
  5793. }
  5794. resp, err := svc.RestoreAddressToClassic(params)
  5795. if err != nil {
  5796. // Print the error, cast err to awserr.Error to get the Code and
  5797. // Message from an error.
  5798. fmt.Println(err.Error())
  5799. return
  5800. }
  5801. // Pretty-print the response data.
  5802. fmt.Println(resp)
  5803. }
  5804. func ExampleEC2_RevokeSecurityGroupEgress() {
  5805. sess, err := session.NewSession()
  5806. if err != nil {
  5807. fmt.Println("failed to create session,", err)
  5808. return
  5809. }
  5810. svc := ec2.New(sess)
  5811. params := &ec2.RevokeSecurityGroupEgressInput{
  5812. GroupId: aws.String("String"), // Required
  5813. CidrIp: aws.String("String"),
  5814. DryRun: aws.Bool(true),
  5815. FromPort: aws.Int64(1),
  5816. IpPermissions: []*ec2.IpPermission{
  5817. { // Required
  5818. FromPort: aws.Int64(1),
  5819. IpProtocol: aws.String("String"),
  5820. IpRanges: []*ec2.IpRange{
  5821. { // Required
  5822. CidrIp: aws.String("String"),
  5823. },
  5824. // More values...
  5825. },
  5826. PrefixListIds: []*ec2.PrefixListId{
  5827. { // Required
  5828. PrefixListId: aws.String("String"),
  5829. },
  5830. // More values...
  5831. },
  5832. ToPort: aws.Int64(1),
  5833. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  5834. { // Required
  5835. GroupId: aws.String("String"),
  5836. GroupName: aws.String("String"),
  5837. PeeringStatus: aws.String("String"),
  5838. UserId: aws.String("String"),
  5839. VpcId: aws.String("String"),
  5840. VpcPeeringConnectionId: aws.String("String"),
  5841. },
  5842. // More values...
  5843. },
  5844. },
  5845. // More values...
  5846. },
  5847. IpProtocol: aws.String("String"),
  5848. SourceSecurityGroupName: aws.String("String"),
  5849. SourceSecurityGroupOwnerId: aws.String("String"),
  5850. ToPort: aws.Int64(1),
  5851. }
  5852. resp, err := svc.RevokeSecurityGroupEgress(params)
  5853. if err != nil {
  5854. // Print the error, cast err to awserr.Error to get the Code and
  5855. // Message from an error.
  5856. fmt.Println(err.Error())
  5857. return
  5858. }
  5859. // Pretty-print the response data.
  5860. fmt.Println(resp)
  5861. }
  5862. func ExampleEC2_RevokeSecurityGroupIngress() {
  5863. sess, err := session.NewSession()
  5864. if err != nil {
  5865. fmt.Println("failed to create session,", err)
  5866. return
  5867. }
  5868. svc := ec2.New(sess)
  5869. params := &ec2.RevokeSecurityGroupIngressInput{
  5870. CidrIp: aws.String("String"),
  5871. DryRun: aws.Bool(true),
  5872. FromPort: aws.Int64(1),
  5873. GroupId: aws.String("String"),
  5874. GroupName: aws.String("String"),
  5875. IpPermissions: []*ec2.IpPermission{
  5876. { // Required
  5877. FromPort: aws.Int64(1),
  5878. IpProtocol: aws.String("String"),
  5879. IpRanges: []*ec2.IpRange{
  5880. { // Required
  5881. CidrIp: aws.String("String"),
  5882. },
  5883. // More values...
  5884. },
  5885. PrefixListIds: []*ec2.PrefixListId{
  5886. { // Required
  5887. PrefixListId: aws.String("String"),
  5888. },
  5889. // More values...
  5890. },
  5891. ToPort: aws.Int64(1),
  5892. UserIdGroupPairs: []*ec2.UserIdGroupPair{
  5893. { // Required
  5894. GroupId: aws.String("String"),
  5895. GroupName: aws.String("String"),
  5896. PeeringStatus: aws.String("String"),
  5897. UserId: aws.String("String"),
  5898. VpcId: aws.String("String"),
  5899. VpcPeeringConnectionId: aws.String("String"),
  5900. },
  5901. // More values...
  5902. },
  5903. },
  5904. // More values...
  5905. },
  5906. IpProtocol: aws.String("String"),
  5907. SourceSecurityGroupName: aws.String("String"),
  5908. SourceSecurityGroupOwnerId: aws.String("String"),
  5909. ToPort: aws.Int64(1),
  5910. }
  5911. resp, err := svc.RevokeSecurityGroupIngress(params)
  5912. if err != nil {
  5913. // Print the error, cast err to awserr.Error to get the Code and
  5914. // Message from an error.
  5915. fmt.Println(err.Error())
  5916. return
  5917. }
  5918. // Pretty-print the response data.
  5919. fmt.Println(resp)
  5920. }
  5921. func ExampleEC2_RunInstances() {
  5922. sess, err := session.NewSession()
  5923. if err != nil {
  5924. fmt.Println("failed to create session,", err)
  5925. return
  5926. }
  5927. svc := ec2.New(sess)
  5928. params := &ec2.RunInstancesInput{
  5929. ImageId: aws.String("String"), // Required
  5930. MaxCount: aws.Int64(1), // Required
  5931. MinCount: aws.Int64(1), // Required
  5932. AdditionalInfo: aws.String("String"),
  5933. BlockDeviceMappings: []*ec2.BlockDeviceMapping{
  5934. { // Required
  5935. DeviceName: aws.String("String"),
  5936. Ebs: &ec2.EbsBlockDevice{
  5937. DeleteOnTermination: aws.Bool(true),
  5938. Encrypted: aws.Bool(true),
  5939. Iops: aws.Int64(1),
  5940. SnapshotId: aws.String("String"),
  5941. VolumeSize: aws.Int64(1),
  5942. VolumeType: aws.String("VolumeType"),
  5943. },
  5944. NoDevice: aws.String("String"),
  5945. VirtualName: aws.String("String"),
  5946. },
  5947. // More values...
  5948. },
  5949. ClientToken: aws.String("String"),
  5950. DisableApiTermination: aws.Bool(true),
  5951. DryRun: aws.Bool(true),
  5952. EbsOptimized: aws.Bool(true),
  5953. IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
  5954. Arn: aws.String("String"),
  5955. Name: aws.String("String"),
  5956. },
  5957. InstanceInitiatedShutdownBehavior: aws.String("ShutdownBehavior"),
  5958. InstanceType: aws.String("InstanceType"),
  5959. KernelId: aws.String("String"),
  5960. KeyName: aws.String("String"),
  5961. Monitoring: &ec2.RunInstancesMonitoringEnabled{
  5962. Enabled: aws.Bool(true), // Required
  5963. },
  5964. NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
  5965. { // Required
  5966. AssociatePublicIpAddress: aws.Bool(true),
  5967. DeleteOnTermination: aws.Bool(true),
  5968. Description: aws.String("String"),
  5969. DeviceIndex: aws.Int64(1),
  5970. Groups: []*string{
  5971. aws.String("String"), // Required
  5972. // More values...
  5973. },
  5974. NetworkInterfaceId: aws.String("String"),
  5975. PrivateIpAddress: aws.String("String"),
  5976. PrivateIpAddresses: []*ec2.PrivateIpAddressSpecification{
  5977. { // Required
  5978. PrivateIpAddress: aws.String("String"), // Required
  5979. Primary: aws.Bool(true),
  5980. },
  5981. // More values...
  5982. },
  5983. SecondaryPrivateIpAddressCount: aws.Int64(1),
  5984. SubnetId: aws.String("String"),
  5985. },
  5986. // More values...
  5987. },
  5988. Placement: &ec2.Placement{
  5989. Affinity: aws.String("String"),
  5990. AvailabilityZone: aws.String("String"),
  5991. GroupName: aws.String("String"),
  5992. HostId: aws.String("String"),
  5993. Tenancy: aws.String("Tenancy"),
  5994. },
  5995. PrivateIpAddress: aws.String("String"),
  5996. RamdiskId: aws.String("String"),
  5997. SecurityGroupIds: []*string{
  5998. aws.String("String"), // Required
  5999. // More values...
  6000. },
  6001. SecurityGroups: []*string{
  6002. aws.String("String"), // Required
  6003. // More values...
  6004. },
  6005. SubnetId: aws.String("String"),
  6006. UserData: aws.String("String"),
  6007. }
  6008. resp, err := svc.RunInstances(params)
  6009. if err != nil {
  6010. // Print the error, cast err to awserr.Error to get the Code and
  6011. // Message from an error.
  6012. fmt.Println(err.Error())
  6013. return
  6014. }
  6015. // Pretty-print the response data.
  6016. fmt.Println(resp)
  6017. }
  6018. func ExampleEC2_RunScheduledInstances() {
  6019. sess, err := session.NewSession()
  6020. if err != nil {
  6021. fmt.Println("failed to create session,", err)
  6022. return
  6023. }
  6024. svc := ec2.New(sess)
  6025. params := &ec2.RunScheduledInstancesInput{
  6026. LaunchSpecification: &ec2.ScheduledInstancesLaunchSpecification{ // Required
  6027. ImageId: aws.String("String"), // Required
  6028. BlockDeviceMappings: []*ec2.ScheduledInstancesBlockDeviceMapping{
  6029. { // Required
  6030. DeviceName: aws.String("String"),
  6031. Ebs: &ec2.ScheduledInstancesEbs{
  6032. DeleteOnTermination: aws.Bool(true),
  6033. Encrypted: aws.Bool(true),
  6034. Iops: aws.Int64(1),
  6035. SnapshotId: aws.String("String"),
  6036. VolumeSize: aws.Int64(1),
  6037. VolumeType: aws.String("String"),
  6038. },
  6039. NoDevice: aws.String("String"),
  6040. VirtualName: aws.String("String"),
  6041. },
  6042. // More values...
  6043. },
  6044. EbsOptimized: aws.Bool(true),
  6045. IamInstanceProfile: &ec2.ScheduledInstancesIamInstanceProfile{
  6046. Arn: aws.String("String"),
  6047. Name: aws.String("String"),
  6048. },
  6049. InstanceType: aws.String("String"),
  6050. KernelId: aws.String("String"),
  6051. KeyName: aws.String("String"),
  6052. Monitoring: &ec2.ScheduledInstancesMonitoring{
  6053. Enabled: aws.Bool(true),
  6054. },
  6055. NetworkInterfaces: []*ec2.ScheduledInstancesNetworkInterface{
  6056. { // Required
  6057. AssociatePublicIpAddress: aws.Bool(true),
  6058. DeleteOnTermination: aws.Bool(true),
  6059. Description: aws.String("String"),
  6060. DeviceIndex: aws.Int64(1),
  6061. Groups: []*string{
  6062. aws.String("String"), // Required
  6063. // More values...
  6064. },
  6065. NetworkInterfaceId: aws.String("String"),
  6066. PrivateIpAddress: aws.String("String"),
  6067. PrivateIpAddressConfigs: []*ec2.ScheduledInstancesPrivateIpAddressConfig{
  6068. { // Required
  6069. Primary: aws.Bool(true),
  6070. PrivateIpAddress: aws.String("String"),
  6071. },
  6072. // More values...
  6073. },
  6074. SecondaryPrivateIpAddressCount: aws.Int64(1),
  6075. SubnetId: aws.String("String"),
  6076. },
  6077. // More values...
  6078. },
  6079. Placement: &ec2.ScheduledInstancesPlacement{
  6080. AvailabilityZone: aws.String("String"),
  6081. GroupName: aws.String("String"),
  6082. },
  6083. RamdiskId: aws.String("String"),
  6084. SecurityGroupIds: []*string{
  6085. aws.String("String"), // Required
  6086. // More values...
  6087. },
  6088. SubnetId: aws.String("String"),
  6089. UserData: aws.String("String"),
  6090. },
  6091. ScheduledInstanceId: aws.String("String"), // Required
  6092. ClientToken: aws.String("String"),
  6093. DryRun: aws.Bool(true),
  6094. InstanceCount: aws.Int64(1),
  6095. }
  6096. resp, err := svc.RunScheduledInstances(params)
  6097. if err != nil {
  6098. // Print the error, cast err to awserr.Error to get the Code and
  6099. // Message from an error.
  6100. fmt.Println(err.Error())
  6101. return
  6102. }
  6103. // Pretty-print the response data.
  6104. fmt.Println(resp)
  6105. }
  6106. func ExampleEC2_StartInstances() {
  6107. sess, err := session.NewSession()
  6108. if err != nil {
  6109. fmt.Println("failed to create session,", err)
  6110. return
  6111. }
  6112. svc := ec2.New(sess)
  6113. params := &ec2.StartInstancesInput{
  6114. InstanceIds: []*string{ // Required
  6115. aws.String("String"), // Required
  6116. // More values...
  6117. },
  6118. AdditionalInfo: aws.String("String"),
  6119. DryRun: aws.Bool(true),
  6120. }
  6121. resp, err := svc.StartInstances(params)
  6122. if err != nil {
  6123. // Print the error, cast err to awserr.Error to get the Code and
  6124. // Message from an error.
  6125. fmt.Println(err.Error())
  6126. return
  6127. }
  6128. // Pretty-print the response data.
  6129. fmt.Println(resp)
  6130. }
  6131. func ExampleEC2_StopInstances() {
  6132. sess, err := session.NewSession()
  6133. if err != nil {
  6134. fmt.Println("failed to create session,", err)
  6135. return
  6136. }
  6137. svc := ec2.New(sess)
  6138. params := &ec2.StopInstancesInput{
  6139. InstanceIds: []*string{ // Required
  6140. aws.String("String"), // Required
  6141. // More values...
  6142. },
  6143. DryRun: aws.Bool(true),
  6144. Force: aws.Bool(true),
  6145. }
  6146. resp, err := svc.StopInstances(params)
  6147. if err != nil {
  6148. // Print the error, cast err to awserr.Error to get the Code and
  6149. // Message from an error.
  6150. fmt.Println(err.Error())
  6151. return
  6152. }
  6153. // Pretty-print the response data.
  6154. fmt.Println(resp)
  6155. }
  6156. func ExampleEC2_TerminateInstances() {
  6157. sess, err := session.NewSession()
  6158. if err != nil {
  6159. fmt.Println("failed to create session,", err)
  6160. return
  6161. }
  6162. svc := ec2.New(sess)
  6163. params := &ec2.TerminateInstancesInput{
  6164. InstanceIds: []*string{ // Required
  6165. aws.String("String"), // Required
  6166. // More values...
  6167. },
  6168. DryRun: aws.Bool(true),
  6169. }
  6170. resp, err := svc.TerminateInstances(params)
  6171. if err != nil {
  6172. // Print the error, cast err to awserr.Error to get the Code and
  6173. // Message from an error.
  6174. fmt.Println(err.Error())
  6175. return
  6176. }
  6177. // Pretty-print the response data.
  6178. fmt.Println(resp)
  6179. }
  6180. func ExampleEC2_UnassignPrivateIpAddresses() {
  6181. sess, err := session.NewSession()
  6182. if err != nil {
  6183. fmt.Println("failed to create session,", err)
  6184. return
  6185. }
  6186. svc := ec2.New(sess)
  6187. params := &ec2.UnassignPrivateIpAddressesInput{
  6188. NetworkInterfaceId: aws.String("String"), // Required
  6189. PrivateIpAddresses: []*string{ // Required
  6190. aws.String("String"), // Required
  6191. // More values...
  6192. },
  6193. }
  6194. resp, err := svc.UnassignPrivateIpAddresses(params)
  6195. if err != nil {
  6196. // Print the error, cast err to awserr.Error to get the Code and
  6197. // Message from an error.
  6198. fmt.Println(err.Error())
  6199. return
  6200. }
  6201. // Pretty-print the response data.
  6202. fmt.Println(resp)
  6203. }
  6204. func ExampleEC2_UnmonitorInstances() {
  6205. sess, err := session.NewSession()
  6206. if err != nil {
  6207. fmt.Println("failed to create session,", err)
  6208. return
  6209. }
  6210. svc := ec2.New(sess)
  6211. params := &ec2.UnmonitorInstancesInput{
  6212. InstanceIds: []*string{ // Required
  6213. aws.String("String"), // Required
  6214. // More values...
  6215. },
  6216. DryRun: aws.Bool(true),
  6217. }
  6218. resp, err := svc.UnmonitorInstances(params)
  6219. if err != nil {
  6220. // Print the error, cast err to awserr.Error to get the Code and
  6221. // Message from an error.
  6222. fmt.Println(err.Error())
  6223. return
  6224. }
  6225. // Pretty-print the response data.
  6226. fmt.Println(resp)
  6227. }