Skip to content

Commit 88c338c

Browse files
NRL-1841 Troubleshooting notes for bastion
1 parent e67e6cc commit 88c338c

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

terraform/bastion/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Before deploying a bastion, you will need:
88

99
- An AWS account that has already been bootstrapped, as described in [bootstrap/README.md](../bootstrap/README.md) and has the account-wide infrastructure deployed as described in [account-wide-infrastructure/README.md](../account-wide-infrastructure/README.md). This is a one-time account setup step.
1010
- Your CLI configured to allow authentication to your AWS account
11+
- Install the [Session Manager plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html)
1112

1213
## Deploying a bastion
1314

@@ -17,39 +18,40 @@ To deploy a bastion, you will first need to login to the AWS mgmt account on the
1718

1819
Then, initialise the Terraform workspace with:
1920

20-
```
21+
```sh
22+
assume management
2123
terraform init
2224
```
2325

2426
If you want a read-only bastion (can only READ from the pointers table), plan the deployment like this:
2527

26-
```
28+
```sh
2729
make plan-ro
2830
```
2931

3032
If you want a read-write bastion (can READ and WRITE from the pointers table), plan the deployment like this:
3133

32-
```
34+
```sh
3335
make plan-rw
3436
```
3537

3638
Once you're happy with your planned changes, you can apply them with:
3739

38-
```
40+
```sh
3941
terraform apply ./bastion.tfplan
4042
```
4143

4244
## Using the bastion
4345

4446
Once the bastion is deployed, you can connect to it via SSH with:
4547

46-
```
48+
```sh
4749
make ssh-connection
4850
```
4951

5052
Once connected successfully, you will be at the SSM `$` prompt. To switch to the `nrlf_ops` user, run this command:
5153

52-
```
54+
```sh
5355
sudo su - nrlf_ops
5456
```
5557

@@ -68,7 +70,7 @@ see [user-data.sh](./scripts/user-data.sh) for exactly what's installed on there
6870

6971
If you're running the `make ssh-connection` and are seeing this error:
7072

71-
```
73+
```sh
7274
$ make ssh-connection
7375
....
7476
An error occurred (TargetNotConnected) when calling the StartSession operation: i-06ff25164f004bee4 is not connected.
@@ -78,21 +80,23 @@ $
7880

7981
If you've just created a new bastion, it may be that it hasn't started yet. Log in to the AWS console to see the state of the EC2 instance. Press the "Connect" button in the console and choose the SSM tab to see if things are working ok.
8082

83+
If there is a warning in the Session Manager tab "SSM Agent is not online" when you attempt to connect then it's likely the SSM agent has crashed. Reboot the EC2 instance and the SSM agent should start up with previous cli history preserved. Beware: rebooting the EC2 instance will terminate any ongoing processes.
84+
8185
If the EC2 instance is running and the console looks ok, check you have defined the correct ENV param for the installed bastion.
8286

8387
#### The `nrlf_ops` using is missing
8488

8589
If you're getting this error:
8690

87-
```
91+
```sh
8892
$ sudo su - nrlf_ops
8993
su: user some_other does not exist or the user entry does not contain all the required fields
9094
$
9195
```
9296

9397
If you've just created a new bastion, you may need to wait a little until the cloud-init script has finished. You can check the status of this process with:
9498

95-
```
99+
```sh
96100
sudo tail -f /var/log/cloud-init-output.log
97101
```
98102

@@ -102,7 +106,7 @@ If you're trying to access an AWS resource from the bastion and are getting an a
102106

103107
You can check the role in the AWS console to work out if things are missing and can edit it there too for immediate access to the resources you need.
104108

105-
If you want to permenantly grant new access to the bastion, you can add a policy and attach it to the EC2 instance in [iam.tf](iam.tf)
109+
If you want to permanently grant new access to the bastion, you can add a policy and attach it to the EC2 instance in [iam.tf](iam.tf)
106110

107111
#### A tool I need is missing
108112

0 commit comments

Comments
 (0)