-
Notifications
You must be signed in to change notification settings - Fork 0
/
Storage Tasks - all executed commands.txt
254 lines (216 loc) · 5.13 KB
/
Storage Tasks - all executed commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
aws sso login --profile aws_admin_user1
$vpcId = (aws ec2 `
create-vpc `
--profile aws_admin_user1 `
--no-paginate `
--no-cli-pager `
--cidr-block 10.0.0.0/16 `
--amazon-provided-ipv6-cidr-block `
--tag-specifications file://JSON_Files/tags-vpc.json `
--output json | ConvertFrom-Json).Vpc.VpcId
$vpcId
aws ec2 describe-vpcs `
--profile aws_admin_user1 `
--no-paginate `
--no-cli-pager `
--vpc-ids $vpcId
$internetGateway = aws ec2 `
create-internet-gateway `
--profile aws_admin_user1 `
--query 'InternetGateway.InternetGatewayId' `
--output text `
--no-paginate `
--no-cli-pager
$internetGateway
aws ec2 attach-internet-gateway `
--profile aws_admin_user1 `
--internet-gateway-id $internetGateway `
--vpc-id $vpcId `
--no-cli-pager
aws ec2 `
describe-internet-gateways `
--profile aws_admin_user1 `
--no-paginate `
--no-cli-pager `
--internet-gateway-ids $internetGateway
$subnetId = aws ec2 `
create-subnet `
--profile aws_admin_user1 `
--vpc-id $vpcId `
--cidr-block 10.0.1.0/24 `
--availability-zone us-east-1a `
--query 'Subnet.SubnetId' `
--output text `
--no-cli-pager `
--tag-specifications file://JSON_Files/tags-subnet.json
$subnetId
aws ec2 `
modify-subnet-attribute `
--profile aws_admin_user1 `
--subnet-id $subnetId `
--map-public-ip-on-launch `
--no-cli-pager
aws ec2 `
describe-subnets `
--profile aws_admin_user1 `
--no-paginate `
--no-cli-pager `
--subnet-ids $subnetId
$routeTableId = aws ec2 `
create-route-table `
--profile aws_admin_user1 `
--vpc-id $vpcId `
--query 'RouteTable.RouteTableId' `
--output text `
--no-cli-pager `
--tag-specifications file://JSON_Files/tags-routetable.json
$routeTableId
aws ec2 `
describe-route-tables `
--profile aws_admin_user1 `
--route-table-ids $routeTableId `
--output table `
--no-cli-pager `
--no-paginate
aws ec2 `
create-route `
--profile aws_admin_user1 `
--route-table-id $routeTableId `
--destination-cidr-block 0.0.0.0/0 `
--gateway-id $internetGateway `
--no-cli-pager
aws ec2 `
associate-route-table `
--profile aws_admin_user1 `
--route-table-id $routeTableId `
--subnet-id $subnetId `
--no-cli-pager
$instanceId = aws ec2 `
run-instances `
--profile aws_admin_user1 `
--image-id ami-0bb84b8ffd87024d8 `
--count 1 `
--instance-type t2.micro `
--key-name pem-key-pair `
--subnet-id $subnetId `
--associate-public-ip-address `
--output text `
--query 'Instances[0].InstanceId' `
--no-cli-pager `
--no-paginate `
--tag-specifications file://JSON_Files/tags-instance.json
$instanceId
aws ec2 `
describe-instances `
--profile aws_admin_user1 `
--instance-ids $instanceId `
--no-cli-pager `
--no-paginate `
--output table
$volumeId = aws ec2 `
create-volume `
--profile aws_admin_user1 `
--availability-zone us-east-1a `
--size 10 `
--volume-type standard `
--query 'VolumeId' `
--tag-specifications file://JSON_Files/tags-volume.json `
--output text `
--no-cli-pager `
--no-paginate
$volumeId
aws ec2 `
describe-volumes `
--profile aws_admin_user1 `
--volume-ids $volumeId `
--no-cli-pager `
--no-paginate `
--output table
aws ec2 attach-volume `
--profile aws_admin_user1 `
--volume-id $volumeId `
--instance-id $instanceId `
--device /dev/sdh `
--no-paginate `
--no-cli-pager
aws ec2 modify-volume `
--profile aws_admin_user1 `
--volume-id $volumeId `
--size 25 `
--volume-type gp2 `
--no-paginate `
--no-cli-pager
aws ec2 delete-volume `
--profile aws_admin_user1 `
--volume-id $volumeId `
--no-paginate `
--no-cli-pager
aws ec2 `
terminate-instances `
--profile aws_admin_user1 `
--instance-ids $instanceId `
--no-paginate `
--no-cli-pager
aws ec2 delete-volume `
--profile aws_admin_user1 `
--volume-id $volumeId `
--no-paginate `
--no-cli-pager
aws ec2 `
describe-volumes `
--profile aws_admin_user1 `
--volume-ids $volumeId `
--no-cli-pager `
--no-paginate `
--output table
$policyId = aws iam `
create-policy `
--profile aws_admin_user1 `
--policy-name my-policy `
--policy-document file://JSON_Files/policy-s3.json `
--output text `
--query 'Policy.Arn' `
--no-cli-pager
$policyId
aws iam `
get-policy `
--profile aws_admin_user1 `
--policy-arn $policyId `
--output table `
--no-paginate `
--no-cli-pager
$bucketName = "my-object-storage-bucket"
aws s3api `
create-bucket `
--profile aws_admin_user1 `
--bucket $bucketName `
--no-paginate `
--output table `
--region us-east-1 `
--no-cli-pager
aws s3api `
list-buckets `
--profile aws_admin_user1 `
--no-paginate `
--output table `
--region us-east-1 `
--no-cli-pager
aws s3 cp my-s3-file.txt s3://$bucketName/ `
--profile aws_admin_user1 `
--no-cli-pager
aws s3 ls s3://$bucketName/ `
--profile aws_admin_user1 `
--recursive `
--human-readable `
--no-cli-pager
aws s3 rm s3://$bucketName/my-s3-file.txt `
--profile aws_admin_user1 `
--no-cli-pager
aws s3 rb s3://$bucketName `
--profile aws_admin_user1 `
--force `
--no-cli-pager
aws ec2 terminate-instances `
--profile aws_admin_user1 `
--instance-ids $instanceId `
--no-cli-pager