Bootstrapping EC2 using User Data Flashcards

1
Q

What is bootstrapping?

A

Bootstrapping is a process where scripts or other config steps can be run when an instance is first launched.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is bootstrapping useful for?

A

This allows an instance to be brought to service in a particular pre-configured state - including configuration and software installs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does bootstrapping allow you to achieve in AWS EC2?

A

Allows EC2 to build automation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does bootstrapping normally uses from EC2 instances?

A

Bootstrapping is done using user data and it is injected into the instance in the same way that meta-data is.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you access bootstrapping user data?

A

Via the meta-data IP: http://169.254.169.254/latest/user-data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When and by what are the bootstrapping scripts executed?

A

executed by the instance OS only once on launch time!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Does EC2 run any validation on the user data?

A

No. You need to be careful with this because the OS needs to understand the data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Once the bootstrapping scripts (meta-data) are executed, in which states can you find the EC2 instance?

A
  • Running state and ready for service.
  • Bad config but still likely running.
    • The instance will probably still pass its checks.
    • It will not be configured as you expected.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Mention some key points related to User data:

A
  • EC2 doesn’t know what the user data contains, it’s just a block of data.
  • The user data is not secure, anyone can see what gets passed in. For this reason it is important not to pass passwords or long term credentials.
  • The user data is limited in size - 16 KB
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Is the user data limited in some way in size?

A
  • User data is limited to 16 KB in size. Anything larger than this will need to pass a script to download the larger set of data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens if you want to modify the user data? Can you stop the instance, modify the user data and restart the instance to apply the changes?

A

No, the user data will be executed only at launch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the boot-time-to-service-time?

A

How quickly after you launch an instance is it ready for service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What processes are included in the Boot-Time-To-Service-Time?

A

EC2 to provision the instance and the time required for any software downloads that are needed for the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Where can you use AMI baking together with bootstrapping?

A

To reduce the boot-time-to-service-time, you can configure as much as possible in your backed AMI.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is post launch time?

A

manual or automatic configuration done in the instance before the instance is ready for service.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can bootstrapping influence the post launch time?

A

Bootstrapping makes possible to launch the instance and then automate the configuration of the instance after it was launched, reducing the post launch time.

17
Q

What are the trades of using AMI baking for EC2 pre-configuration and SW installations vs bootstrapping?

A

AMI baking can work in advance, reducing the time needed to get the instance at the desired state.
It also reduces flexibility of configuration.

18
Q

What is the best way to deal with AMI baking and bootstrapping trades?

A

Combining them. Do all the time-intensive work before with AMI baking, then do the specifics with bootstrapping.

In this way you have flexibility and reduced post launch time.

19
Q

Where can you find logs from the bootstrapping executions in EC2 instances?

A

/var/log/cloud-init-output.log

20
Q

What do you need to do in advance when using cloudformation to bootstrap an EC2 instance?

A

You need to encode the user-data in Base64.

It happens automatically using the GUI but in cloudFormation you need to do it manually.