首页 \ 问答 \ AWS EC2:使用CLI启动实例时添加标记(AWS EC2: Add a tag when launching an instance using CLI)

AWS EC2:使用CLI启动实例时添加标记(AWS EC2: Add a tag when launching an instance using CLI)

如果要在启动时向实例添加标记,则必须执行两个步骤:

  1. 启动实例( run-instances
  2. 将标记添加到新创建的实例( create-tags

使用单个CLI命令启动实例时,是否可以添加标记(或设置名称)?


If you want to add a tag to an instance when launching, you have to perform two steps:

  1. Launch an instance (run-instances)
  2. Add a tag to the newly created instance (create-tags)

Is there a way to add a tag (or set a name) when launching an instance using a single CLI command?


原文:https://stackoverflow.com/questions/45341983
更新时间:2023-10-08 13:10

最满意答案

在猪脚本中试试这个

假设您的输入文件名是input.csv

1.首先使用copyfromlocal命令将此输入文件移动到HDFS。
2.在猪脚本下运行此命令

PigScript:
HDFS模式:

A = LOAD 'hdfs://<hostname>:<port>/user/test/input.csv' AS line;
B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'"(.*)","(.*)"')) AS (id:int,name:chararray);
STORE B INTO '/user/test/output' USING PigStorage(',');

本地模式:

A = LOAD 'input.csv' AS line;
B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'"(.*)","(.*)"')) AS (id:int,name:chararray);
STORE B INTO 'output' USING PigStorage(',');

输出:

Id,Name
1,Raju
2,Anitha
3,Rakesh

Try this in pig script

Suppose your input file name is input.csv

1.First move this input file to HDFS using copyfromlocal command.
2. Run this below pig script

PigScript:
HDFS mode:

A = LOAD 'hdfs://<hostname>:<port>/user/test/input.csv' AS line;
B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'"(.*)","(.*)"')) AS (id:int,name:chararray);
STORE B INTO '/user/test/output' USING PigStorage(',');

Local mode:

A = LOAD 'input.csv' AS line;
B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'"(.*)","(.*)"')) AS (id:int,name:chararray);
STORE B INTO 'output' USING PigStorage(',');

Output:

Id,Name
1,Raju
2,Anitha
3,Rakesh

相关问答

更多
  • 你的猜测有些准确。 通过Hadoop,我想你是指MapReduce? Hadoop本身就是一个由许多组件组成的生态系统(包括MapReduce,HDFS,Pig和Hive)。 当您需要编写用于在Map()和Reduce()方法级别处理数据的逻辑时,MapReduce很好。 在我的工作中,当我处理非结构化和需要清理的数据时,我发现MapReduce非常有用。 Hive,Pig:它们适用于批处理,定期运行(可能需要数小时或数天) HBase&Cassandra:支持低延迟呼叫。 所以它们可以用于响应时间很关键的 ...
  • 使用fs shell命令: fs -rm -f -r /path/to/dir : load_resource_csv = LOAD '/user/cloudera/newfile' USING PigStorage(',') AS (name:chararray, skill:chararray ); fs -rm -r -f /user/hive/warehouse/stack/ STORE load_resource_csv INTO '/user/hive/warehouse/sta ...
  • 上述错误的原因是我的hadoop版本和hbase不兼容。 我安装了hbase-0.98.16-hadoop2,猪代码运行时没有错误。 通常当你看到java.lang.NoSuchMethodError时,它可能是版本之间不兼容的一个指示。 The reason for the error above was incompatibility between my hadoop version and hbase. I installed hbase-0.98.16-hadoop2 and the pig co ...
  • MapReduce只是一个计算框架 。 HBase与此无关。 也就是说,您可以通过编写MapReduce作业来有效地将数据提取到/从HBase中获取。 或者,您可以使用其他HBase API(如Java)编写顺序程序来放置或获取数据。 但是我们使用Hadoop,HBase等来处理大量的数据,所以没有什么意义。 当您的数据太大时,使用正常的顺序程序将非常低效。 回到你问题的第一部分,Hadoop基本上是两件事:一个分布式文件系统(HDFS) +一个计算或处理框架(MapReduce) 。 像所有其他FS一样, ...
  • 好的,我想通了,因为这个话题的信息有限: https://cwiki.apache.org/confluence/display/Hive/HCatalog+LoadStore#HCatalogLoadStore-TypesinHive0.13.0andLater.1 我需要使用DATETIME而不是chararray 类型转换表: Ok I figured it out, since there is limited info on this topic: https://cwiki.apache.org ...
  • 在猪脚本中试试这个 假设您的输入文件名是input.csv 1.首先使用copyfromlocal命令将此输入文件移动到HDFS。 2.在猪脚本下运行此命令 PigScript: HDFS模式: A = LOAD 'hdfs://:/user/test/input.csv' AS line; B = FOREACH A GENERATE FLATTEN(REGEX_EXTRACT_ALL(line,'"(.*)","(.*)"')) AS (id:int,name:chara ...
  • Pig是为处理模式较少的数据集而构建的......在hive中我们强制执行一个存储在derby中的模式,或者可以配置为存储在mysql中。现在还不清楚你在寻找什么! Pig is built to processes schema less data sets..whereas in hive we enforce a schema which is stored in derby or can be configured to store in mysql..Now it is not clear wha ...
  • 我假设您已将数据加载到Hbase中然后在grunt shell提示符下使用以下pig脚本 使用HBaseStorage存储的pig脚本: G1 = LOAD'hbase:// geoinfo1'USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('column_family_name:*',' - loadKey true -gt 10000')AS(sn:chararray,country:chararray) ; I'm assuming tha ...
  • 是。 您将需要HCatalog 。在Pig Shell中运行以下命令来导入必需的罐子。 pig -useHCatalog 然后将表加载到像这样的关系中 A = LOAD 'tablename' USING org.apache.hive.hcatalog.pig.HCatLoader(); Yes. You will need HCatalog.In Pig Shell run the below command to import the necessary jars. pig -useHCatalo ...
  • 猪没有任何内置功能来解决您的需求,但您可以尝试以下方法,我想它会适合您。 input.txt中 1 j1 f1 m1 2 j2 f2 m2 3 j3 f3 m3 PigScript: A = LOAD 'input.txt' USING PigStorage() AS (id,month1,month2,month3); B = FOREACH A GENERATE FLATTEN(TOBAG(TOTUPLE( ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)