6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS CLI でいろいろ使用例

Last updated at Posted at 2016-03-17

AWSCLIを触る機会がありましたので、使用例を紹介していきます。

S3からファイルのダウンロード#

S3に置いてあるファイルをダウンロードします。

$ aws s3 cp s3://ダウンロードしたいファイルパス ダウンロード先のパス

使用例

 $ aws s3 cp s3://~~~/~~~/test.txt ./
   download: s3://~~~/~~~/test.txt to ./test.txt

S3へファイルのアップロード#

S3へファイルのアップロードをします。

$ s3 cp アップロード元のパス s3://アップロードしたいファイルパス
使用例

 $ $ aws s3 cp test.txt s3://~~~/~~~/
     upload: ./test.txt to s3://~~~/~~~/test.txt

CloudFormation Stackの作成##

$ aws cloudformation create-stack --region リージョン名 --stack-name スタック名 --template-url テンプレート配置パス --parameters パラメータ=値

使用例

templateファイルパス aws s3 cp s3://~~~/~~~/test.template
stack名 testStack
リージョン ap-northeast-1

使用例

$ aws cloudformation create-stack --stack-name testStack --region ap-northeast-1 --template-url https://s3.amazonaws.com/~~~/~~~/test.template --parameters ParameterKey=KeyName,ParameterValue=valueName 

CloudFormation Stackの削除##

$ aws cloudformation delete-stack --stack-name スタック名 --region リージョン名

使用例

$ aws cloudformation delete-stack --stack-name testStack --region ap-northeast-1

インスタンスの起動状態の確認##

$ aws ec2 describe-instances --instance-ids インスタンスID --region リージョン

使用例

aws ec2 describe-instances --instance-ids ○-××××× --region ap-northeast-1

インスタンスリブード##

$ aws ec2 reboot-instances --instance-ids インスタンスID --region リージョン

使用例

**$ aws ec2 reboot-instances --instance-ids ○-××××× --region ap-northeast-1**

インスタンスのターミネート##

$ aws ec2 terminate-instances --instance-ids インスタンスID --region リージョン

使用例

aws ec2 terminate-instances --instance-ids ○-××××× --region ap-northeast-1

最後に#

今後もどんどん更新していければと思います。
使用するさいはインスタンスIDを間違えないようご注意ください。。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?