Skip to content

Commit 58de88b

Browse files
committed
Make code easier to copy/paste.
1 parent e9e9d06 commit 58de88b

File tree

7 files changed

+34
-34
lines changed

7 files changed

+34
-34
lines changed

labs/aws/in-person/python/lab-01/02-configuring-aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pip3 install pulumi-aws
1515
Now that the AWS package is installed, add the following line to `__main__.py` to import it:
1616

1717
```python
18-
...
18+
# ...
1919
import pulumi_aws as aws
2020
```
2121

labs/aws/in-person/python/lab-01/03-provisioning-infrastructure.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Now that you have a project configured to use AWS, you'll create some basic infr
77
Add the following to your `__main__.py` file:
88

99
```python
10-
...
10+
# ...
1111
bucket = aws.s3.Bucket("my-bucket")
1212
```
1313

@@ -87,7 +87,7 @@ To inspect your new bucket, you will need its physical AWS name. Pulumi records
8787
Programs can export variables which will be shown in the CLI and recorded for each deployment. Export your bucket's name by adding this line to `__main__.py`:
8888

8989
```python
90-
...
90+
# ...
9191
pulumi.export('bucket_name', bucket.bucket)
9292
```
9393

@@ -102,7 +102,7 @@ pulumi up
102102
Notice a new `Outputs` section is included in the output containing the bucket's name:
103103

104104
```
105-
...
105+
# ...
106106
107107
Outputs:
108108
+ bucket_name: "my-bucket-8257ac5"

labs/aws/in-person/python/lab-01/04-updating-your-infrastructure.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ Create a directory `site/` and add a new `index.html` file with the following co
2323
Add an import to your `__main__.py` file:
2424

2525
```python
26-
...
26+
# ...
2727
import os
28-
...
28+
# ...
2929
```
3030

3131
And then add these lines to `__main__.py` right after creating the bucket itself:
3232

3333
```python
34-
...
34+
# ...
3535
filepath = os.path.join("site", "index.html")
3636
obj = aws.s3.BucketObject("index.html",
3737
bucket=bucket.id,
3838
source=pulumi.FileAsset(filepath)
3939
)
40-
...
40+
# ...
4141
```
4242

4343
> :white_check_mark: After these changes, your `__main__.py` should [look like this](./code/04-updating-your-infrastructure/step1.py).
@@ -87,19 +87,19 @@ To serve content from your bucket as a website, you'll need to update a few prop
8787
First, your bucket needs a website property that sets the default index document to `index.html`:
8888

8989
```python
90-
...
90+
# ...
9191
bucket = aws.s3.Bucket("my-bucket",
9292
website={
9393
"index_document": "index.html"
9494
})
95-
...
95+
# ...
9696
```
9797

9898
Next, your `index.html` object will need two changes: an ACL of `public-read` so that it can be accessed anonymously over the Internet, and a content type so that it is served as HTML:
9999

100100
```python
101101
import mimetypes
102-
...
102+
# ...
103103
filepath = os.path.join("site", "index.html")
104104
mime_type, _ = mimetypes.guess_type(filepath)
105105
obj = aws.s3.BucketObject("index.html",
@@ -108,15 +108,15 @@ obj = aws.s3.BucketObject("index.html",
108108
acl="public-read",
109109
content_type=mime_type
110110
)
111-
...
111+
# ...
112112
```
113113

114114
Finally, export the resulting bucket's endpoint URL so we can easily access it:
115115

116116
```python
117-
...
117+
# ...
118118
pulumi.export('bucket_endpoint', pulumi.Output.concat("http://", bucket.website_endpoint))
119-
...
119+
# ...
120120
```
121121

122122
> :white_check_mark: After these changes, your `__main__.py` should [look like this](./code/04-updating-your-infrastructure/step2.py).

labs/aws/in-person/python/lab-01/05-making-your-stack-configurable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Updating (dev):
123123
Type Name Status
124124
pulumi:pulumi:Stack iac-workshop-dev
125125
+ └─ aws:s3:BucketObject about.html created
126-
...
126+
# ...
127127
```
128128

129129
Now fetch it:

labs/aws/in-person/python/lab-02/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Now you will create multiple VM instances, each running the same Python webserve
114114
your region. Replace the part of your code that creates the webserver and exports the resulting IP address and hostname with the following:
115115

116116
```python
117-
...
117+
# ...
118118
ips = []
119119
hostnames = []
120120
for az in aws.get_availability_zones().names:
@@ -208,7 +208,7 @@ target group used by the load balancer to route requests, you must verify that t
208208
traffic on the new port in both directions.
209209

210210
```python
211-
...
211+
# ...
212212
group = aws.ec2.SecurityGroup(
213213
"web-secgrp",
214214
description='Enable HTTP access',
@@ -220,15 +220,15 @@ group = aws.ec2.SecurityGroup(
220220
{ 'protocol': 'tcp', 'from_port': 80, 'to_port': 80, 'cidr_blocks': ['0.0.0.0/0'] },
221221
]
222222
)
223-
...
223+
# ...
224224
```
225225

226226
This is required to ensure the security group ingress rules don't conflict with the load balancer's.
227227

228228
Now right after the security group creation, and before the VM creation block, add the load balancer creation steps:
229229

230230
```python
231-
...
231+
# ...
232232
default_vpc = aws.ec2.get_vpc(default="true")
233233
default_vpc_subnets = aws.ec2.get_subnet_ids(vpc_id=default_vpc.id)
234234

@@ -254,13 +254,13 @@ listener = aws.lb.Listener("listener",
254254
"target_group_arn": target_group.arn
255255
}]
256256
)
257-
...
257+
# ...
258258
```
259259

260260
And then replace the VM creation block with the following:
261261

262262
```python
263-
...
263+
# ...
264264
ips = []
265265
hostnames = []
266266
for az in aws.get_availability_zones().names:

labs/aws/in-person/python/lab-03/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import pulumi_aws as aws
1717
And now create a new ECS cluster. You will use the default values, so doing so is very concise:
1818

1919
```python
20-
...
20+
# ...
2121
cluster = aws.ecs.Cluster("cluster")
2222
```
2323

@@ -29,7 +29,7 @@ Next, allocate the application load balancer (ALB) and listen for HTTP traffic p
2929
default VPC and the subnet groups for it:
3030

3131
```python
32-
...
32+
# ...
3333
default_vpc = aws.ec2.get_vpc(default="true")
3434
default_vpc_subnets = aws.ec2.get_subnet_ids(vpc_id=default_vpc.id)
3535

@@ -83,7 +83,7 @@ import json
8383
```
8484

8585
```python
86-
...
86+
# ...
8787
role = aws.iam.Role("task-exec-role",
8888
assume_role_policy=json.dumps({
8989
"Version": "2008-10-17",
@@ -192,17 +192,17 @@ And you'll see the Nginx default homepage:
192192
<html>
193193
<head>
194194
<title>Welcome to nginx!</title>
195-
...
195+
# ...
196196
```
197197

198198
## Step 5 &mdash; Update the Service
199199

200200
Now, also update the desired container count from `1` to `3`:
201201

202202
```
203-
...
203+
# ...
204204
desiredCount: 3,
205-
...
205+
# ...
206206
```
207207

208208
> :white_check_mark: After this change, your `__main__.py` should [look like this](./code/step5.py).

labs/aws/in-person/python/lab-05/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ You'll now declare a [deployment object](https://kubernetes.io/docs/concepts/wor
7777
Append this to your `__main__.py` file:
7878

7979
```python
80-
...
80+
# ...
8181
app_labels = {
8282
"app": "iac-workshop"
8383
}
@@ -115,7 +115,7 @@ Next, you'll declare a [service object](https://kubernetes.io/docs/concepts/serv
115115
Append this to your `__main__.py` file:
116116

117117
```python
118-
...
118+
# ...
119119
service = Service("app-service",
120120
metadata={
121121
"namespace": ns.metadata["name"],
@@ -136,7 +136,7 @@ service = Service("app-service",
136136
Afterwards, add these lines to export the resulting, dynamically assigned endpoint for the resulting load balancer:
137137

138138
```python
139-
...
139+
# ...
140140
export('url', Output.all(service.status['load_balancer']['ingress'][0]['hostname'], service.spec['ports'][0]['port'])\
141141
.apply(lambda args: f"http://{args[0]}:{round(args[1])}"))
142142
```
@@ -222,17 +222,17 @@ Note that the application says `Demo application version v0.10.0-blue` in the ba
222222
First update your deployment's configuration's replica count:
223223

224224
```
225-
...
225+
# ...
226226
replicas=3,
227-
...
227+
# ...
228228
```
229229

230230
And then update its image to:
231231

232232
```
233-
...
233+
# ...
234234
image="jocatalin/kubernetes-bootcamp:v2",
235-
...
235+
# ...
236236
```
237237

238238
> :white_check_mark: After this change, your `__main__.py` should [look like this](./code/step6.py).

0 commit comments

Comments
 (0)