Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom tag for all AWS entities #469

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions amlb/runners/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ def _start_instance(self, instance_def, script_params="", instance_key=None, tim
if instance_def.volume_size:
ebs['VolumeSize'] = instance_def.volume_size

instance_tags = ec2_config.instance_tags | ns(Name=f"amlb_{inst_key}")
volume_tags = (ec2_config.volume_tags or instance_tags) | ns(Name=f"amlb_{inst_key}")
instance_params = dict(
BlockDeviceMappings=[dict(
DeviceName=ec2_config.root_device_name,
Expand All @@ -582,15 +584,11 @@ def _start_instance(self, instance_def, script_params="", instance_key=None, tim
TagSpecifications=[
dict(
ResourceType='instance',
Tags=[
dict(Key='Name', Value=f"benchmark_{inst_key}")
]
Tags=[dict(Key=k, Value=v) for k, v in instance_tags]
),
dict(
ResourceType='volume',
Tags=[
dict(Key='Name', Value=f"benchmark_{inst_key}")
]
Tags=[dict(Key=k, Value=v) for k, v in volume_tags]
),
],
UserData=self._ec2_startup_script(inst_key, script_params=script_params, timeout_secs=timeout_secs)
Expand Down
2 changes: 2 additions & 0 deletions resources/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ aws: # configuration namespace for AWS mode.
'4': xlarge
'8': 2xlarge
'16': 4xlarge
instance_tags: {} # specify custom tags for the EC2 instances here
volume_type: standard # one of gp2, io1, st1, sc1, or standard (default).
volume_tags: {} # specify custom tags for the volume tags here (if empty, will apply the same tags as the corresponding instance)
root_device_name: '/dev/sda1' #
availability_zone: # the availability zone where the instances will be created (if not set, aws will pick a default one).
subnet_id: '' #
Expand Down