Skip to content

Commit 276c916

Browse files
authored
[IT-3831] Update AMI and docs (#6)
Update agora-data-manager-github-runner AMI and general project documentation. depends on Sage-Bionetworks/aws-infra#421
1 parent c3d011c commit 276c916

File tree

2 files changed

+54
-22
lines changed

2 files changed

+54
-22
lines changed

README.md

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,52 @@ Request using PRs provide history, gating, reviewing and an approval
77
process.
88

99
### Add Images
10-
Step by step instructions to add a new image to the image builder:
11-
12-
1. Add image builder cloudformation templates should be added to
13-
[Sage-Bionetworks/aws-infra](https://github.com/Sage-Bionetworks/aws-infra)
14-
repo in the templates/ImageBuilder directory.
15-
2. Add a new Sceptre config in `config/prod` directory referencing
16-
a versioned (or tagged) instance of the cloudformation template.
17-
3. Create a PR to merge the new config into the `main` branch.
18-
4. Once the PR is merged, the image builder will be triggered to
19-
to deploy to the AWS org-sagebase-imagecentral account which will then
20-
trigger a build of the AMI.
21-
5. The AMI will be shared to all accounts in our AWS organization which
22-
means that it is searchable using the AWS console (EC2-Instances-AMIs or
23-
Image Builder->Images) or the AWS CLI from any AWS account in our organization.
24-
10+
Step by step instructions to create a new image:
11+
12+
The first step is to create the definition template:
13+
1. Create an Image Builder definition (cloudformation) template and add it to
14+
the [Sage-Bionetworks/aws-infra](https://github.com/Sage-Bionetworks/aws-infra)
15+
repo in the `templates/ImageBuilder` directory.
16+
2. Create a PR with this change to aws-infra repo
17+
3. Review, approve and Merge the PR
18+
4. Tag the repo with a [version number](https://github.com/Sage-Bionetworks/aws-infra/tags)
19+
20+
Next step is to use the definition template to provision an AMI:
21+
1. In this repo, add a new Sceptre config in `config/prod` directory referencing
22+
a versioned (or tagged) instance of the cloudformation template. Set the
23+
the `ImageVersion` to the same number as the aws-infra repo tag (i.e. 0.9.2 without the `v`).
24+
It must match a [semantic version](https://semver.org/) number.
25+
2. Create a PR to merge the new config into the `main` branch.
26+
3. Once the PR is merged, the cloudformation template will be deployed to the
27+
AWS org-sagebase-imagecentral account which will in turn trigger a build
28+
of the image which will generate an AMI.
29+
4. The AMI will be shared to all accounts in our AWS organization which
30+
means that it is searchable from any of our AWS accounts using either the
31+
AWS console EC2 Instances->AMIs or Image Builder->Images pages. The AMI is
32+
also searchable using the AWS CLI
33+
[describe-images command](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html).
34+
35+
36+
### Updating Images
37+
To update an image the we must first update aws-infra then this repo.
38+
39+
Update the cloudformation template in aws-infra:
40+
1. Create a PR to update the ImageBuilder cloudformation template in the aws-infra repo
41+
2. Review, approve and Merge the PR
42+
3. Tag the repo with a version number
43+
44+
Update the Sceptre config in this repo:
45+
1. Create a PR to update the template `url` reference and `ImageVersion` number
46+
in the Sceptre config file.
47+
2. Review, approve and Merge the PR
48+
3. Once merged the cloudformation template will be deployed which will trigger
49+
an update to the AMI. AMIs are immutable therefore AWS will create a new AMI
50+
on every change. The updated AMIs will retain the same name, only the version
51+
number is updated.
52+
53+
__Note__: An update to the image definition (or cloudformation template) requires
54+
an `ImageVersion` update otherwise cloudformation may fail with a message similar to
55+
`The following resource XXXXX already exists..`.
2556

2657
### Removing Images
2758
Important info when removing image builder resources and the generated
@@ -37,14 +68,14 @@ situations where it is appropriate to delete AMIs, for example when testing AMIs
3768
To delete AMIs go into the AWS console EC2 -> Images -> AMIs, search for the AMIs
3869
then delete (or de-register) them.
3970

40-
__NOTE__: Steps above can also be done using the `sceptre delete` command or the AWS CLI.
71+
__NOTE__: Step #2 above can also be done using the `sceptre delete` command or the AWS CLI.
4172

4273
### Testing Images
4374
To test an image we recommend that you manually provision an EC2 instance from the
4475
AMI image then connect to it using the [AWS session manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html)
4576
or [SSH](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-linux-inst-ssh.html).
46-
Validate that the instance contains everything that was specified from the image builder and
47-
that it's generally running as expected.
77+
Validate that the image meets the specifications defined in the cloudformation template and
78+
that image is generally running as expected.
4879

4980

5081
## Contributions
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
template:
22
type: "http"
3-
url: "https://raw.githubusercontent.com/Sage-Bionetworks/aws-infra/v0.9.3/templates/ImageBuilder/amazon-linux-2023-agora-bastian.yaml"
3+
url: "https://raw.githubusercontent.com/Sage-Bionetworks/aws-infra/v0.9.4/templates/ImageBuilder/amazon-linux-2023-agora-bastian.yaml"
44
stack_name: "agora-data-manager-github-runner"
55
stack_tags:
6-
OwnerEmail: "it@sagebase.org"
7-
CostCenter: "Platform Infrastructure / 990300"
6+
OwnerEmail: "jessica.britton@sagebase.org"
7+
CostCenter: "Agora / 112300"
88
parameters:
9-
ImageVersion: "0.0.1"
9+
ImageVersion: "0.9.4"
10+
VolumeSize: "50"

0 commit comments

Comments
 (0)