Skip to content

Commit

Permalink
Merge pull request #85 from craigcomstock/CFE-4322
Browse files Browse the repository at this point in the history
CFE-4322: Changed cf-remote spawn with AWS to query for AMI from known owners
  • Loading branch information
craigcomstock committed Apr 2, 2024
2 parents 82de565 + 261a5dd commit 734973d
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 191 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,9 @@ To install `cf-remote` so that it reflects any changes in this source directory
```
$ pip install --editable .
```

## cloud_data.py tips

In order to find AWS images for a particular owner to work on cloud_data.py name_pattern list the names for an owner with the following `aws` command:

aws ec2 describe-images --region us-east-2 --owners 801119661308 --query 'Images[*].[Name]' --output text
216 changes: 55 additions & 161 deletions cf_remote/cloud_data.py
Original file line number Diff line number Diff line change
@@ -1,179 +1,73 @@
aws_platforms = {
"ubuntu-22-04-arm64": {
"ami": "ami-00c50882a52d323a6",
"user": "ubuntu",
"size": "t4g.micro",
"xlsize": "t4g.xlarge",
},
"ubuntu-22-04-x64": {
"ami": "ami-01dd271720c1ba44f",
"user": "ubuntu",
"size": "t2.small",
"xlsize": "t3.xlarge",
},
"ubuntu-20-04-x64": {
"ami": "ami-0aef57767f5404a3c",
"user": "ubuntu",
"size": "t2.small",
"xlsize": "t3.xlarge",
},
"ubuntu-18-04-x64": {
"ami": "ami-0ee3436f275c4f2e8",
"user": "ubuntu",
"size": "m1.small",
"xlsize": "m3.xlarge",
},
"ubuntu-14-04-x32": {
"ami": "ami-07a1e6256cb43b99c",
"user": "ubuntu",
"size": "m1.small",
},
"debian-8-x64": {
"ami": "ami-402f1a33",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"debian-7-x64": {
"ami": "ami-61e56916",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"debian-9-x64": {
"ami": "ami-035c67e6a9ef8f024",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"debian-10-x64": {
"ami": "ami-0a9d04ba7d4df6c3b",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"debian-11-arm64": {
"ami": "ami-0353cb95279bf4f20",
"user": "admin",
"size": "t4g.micro",
"xlsize": "t4g.xlarge",
},
"debian-11-x64": {
"ami": "ami-0293236c9a0c23a77",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"debian-12-arm64": {
"ami": "ami-03820227fb3e4ffad",
aws_defaults = {
"architecture": "x86_64",
"sizes": {
"x86_64": {
"size": "t2.micro",
"xlsize": "t2.xlarge",
},
"arm64": {
"size": "t4g.micro",
"xlsize": "t4g.xlarge",
},
},
"user": "ec2-user",
}
aws_image_criteria = {
"debian-9": {
"owner_id": "379101102735",
"name_pattern": "debian-stretch-hvm-x86_64*",
"user": "admin",
"size": "t4g.micro",
"xlsize": "t4g.xlarge",
},
"debian-12-x64": {
"ami": "ami-07024fbdfd1aab8a0",
"debian": {
"owner_id": "136693071363",
"name_pattern": "debian-{version}*",
"user": "admin",
"size": "t1.micro",
"xlsize": "m3.xlarge",
},
"centos-6-x64": {
"ami": "ami-05bd23226cb7c2896",
"user": "centos",
"size": "t2.micro",
"xlsize": "m3.xlarge",
},
"centos-7-x64": {
"ami": "ami-0f4775c518fa29365",
"user": "centos",
"size": "t2.micro",
"xlsize": "m3.xlarge",
},
"rhel-5-x64": {
"ami": "ami-ea94369d",
"size": "t1.micro",
"user": "root",
"xlsize": "t1.micro",
},
"rhel-6-x64": {
"ami": "ami-c1bb06b2",
"size": "t2.micro",
"user": "ec2-user",
"xlsize": "t2.large",
},
"rhel-7-x64": {
"ami": "ami-065ec1e661d619058",
"size": "t2.micro",
"user": "ec2-user",
"xlsize": "t2.large",
},
"rhel-8-x64": {
"ami": "ami-08f4717d06813bf00",
"size": "t3a.micro",
"user": "ec2-user",
"xlsize": "m3.xlarge",
},
"rhel-9-x64": {
"ami": "ami-049b0abf844cab8d7",
"size": "t3a.micro",
"user": "ec2-user",
"xlsize": "m3.xlarge"
},
"centos-5-x32": {"ami": "ami-fe11398a", "user": "root", "size": "m1.small"},
"debian-6-x64": {"ami": "ami-879e4ff0", "user": "admin", "size": "t1.micro"},
"debian-5-x32": {"ami": "ami-8398b3f7", "user": "root", "size": "m1.small"},
"debian-7-x32": {"ami": "ami-1be06c6c", "user": "admin", "size": "t1.micro"},
"debian-4-x32": {"ami": "ami-8198b3f5", "user": "root", "size": "m1.small"},
"ubuntu-12-04-x64": {
"ami": "ami-d1767bb7",
"ubuntu-16": {
"owner_id": "099720109477",
"name_pattern": "ubuntu-pro-server/images/hvm-ssd/ubuntu-xenial-16.04-amd64-pro-server*",
"user": "ubuntu",
"size": "m1.small",
"xlsize": "m3.xlarge",
},
"debian-6-x32": {"ami": "ami-8d9e4ffa", "user": "admin", "size": "t1.micro"},
"ubuntu-16-04-x64": {
"ami": "ami-0d47c52ffe8fef155",
"ubuntu": {
"owner_id": "099720109477",
"name_pattern": "ubuntu/images/hvm-ssd/ubuntu-*-{version}*",
"user": "ubuntu",
"size": "m1.small",
"xlsize": "m3.xlarge",
},
"debian-5-x64": {"ami": "ami-8f98b3fb", "user": "root", "size": "m1.small"},
"debian-4-x64": {"ami": "ami-8d98b3f9", "user": "root", "size": "m1.small"},
"ubuntu-14-04-x64": {
"ami": "ami-0c68b4b8bbbdc39de",
"user": "ubuntu",
"size": "m1.small",
"xlsize": "m3.xlarge",
"centos": {
"note": "This owner is our nt-dev account in AWS so these are private custom images.",
"owner_id": "304194462000",
"name_pattern": "centos-{version}-x64",
"region": "eu-west-1",
},
"rhel": {
"owner_id": "309956199498",
"name_pattern": "RHEL-{version}*",
},
"ubuntu-12-04-x32": {"ami": "ami-5c78753a", "user": "ubuntu", "size": "m1.small"},
"centos-5-x64": {"ami": "ami-f2113986", "user": "root", "size": "m1.small"},
"windows-2012-x64": {
"ami": "ami-045768fc2ae3fa829",
"windows-2008": {
"ami": "ami-09046e654c804633f",
"user": "Administrator",
"size": "m1.small",
"xlsize": "m3.xlarge",
"region": "eu-west-1",
},
"windows-2016-x64": {
"ami": "ami-08f68fefe026532ea",
"windows-2012": {
"ami": "ami-0444b0c023c7f3671",
"user": "Administrator",
"size": "m1.small",
"xlsize": "m3.xlarge",
"region": "eu-west-1",
},
"windows-2019-x64": {
"ami": "ami-0311c2819c6a29312",
"windows-2016": {
"ami": "ami-00a7e5468b339302c",
"user": "Administrator",
"size": "t2.small",
"xlsize": "t2.xlarge",
"region": "eu-west-1",
},
"suse-12-x64": {
"ami": "ami-0d5622d69a166848b",
"user": "ec2-user",
"size": "t2.small",
"xlsize": "t2.xlarge",
"windows-2019": {
"ami": "ami-0311c2819c6a29312",
"user": "Administrator",
"region": "eu-west-1",
},
"suse-15-x64": {
"ami": "ami-0e5e442298b8e7f5a",
"user": "ec2-user",
"size": "t2.small",
"xlsize": "t2.xlarge",
"windows": {
"note": "Note that typically we rely on custom pre-configured windows imimages with ssh installed and pre-populated public keys so an image spawned from this criteria will not come with ssh built-in and ready to go.",
"owner_id": "801119661308",
"name_pattern": "Windows_Server-{version}-English-Core-Base*",
"user": "Administrator",
},
"suse": {"owner_id": "013907871322", "name_pattern": "suse-sles-{version}*"},
}
8 changes: 7 additions & 1 deletion cf_remote/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,14 @@ def destroy(group_name=None):


def list_platforms():
print()
print("Platform images are queried based on the platform name, version and architecture.")
print("The form of platform specified is: <platform_name>[-<version>][-<architecture>]. e.g. debian, debian-12 or debian-12-x64")
print("Ubuntu version can be just major (20) or major+minor (20-04)")
print("Architecture can either be x64 or arm64")
print()
print("Available platforms:")
for key in sorted(cloud_data.aws_platforms.keys()):
for key in sorted(cloud_data.aws_image_criteria.keys()):
print(key)
return 0

Expand Down
Loading

0 comments on commit 734973d

Please sign in to comment.