-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨🚨Autoscaling: Prepare Warmed EBS-backed volumes to use as buffer for…
… machines (⚠️ Devops) 🚨 (#5923)
- Loading branch information
Showing
36 changed files
with
1,724 additions
and
366 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# How to use VSCode on a remote private EC2 | ||
[reference](https://medium.com/@dbpprt/transparently-develop-on-an-ec2-instance-with-vscode-remote-ssh-through-ssm-6e5c5e599ee1) | ||
|
||
## to use from the terminal | ||
|
||
```bash | ||
host i-* mi-* | ||
User ec2-user | ||
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" | ||
``` | ||
|
||
## to use from VSCode | ||
|
||
```bash | ||
host i-*.*.* | ||
User ec2-user | ||
ProxyCommand bash -c "aws ssm start-session --target $(echo %h|cut -d'.' -f1) --profile $(echo %h|/usr/bin/cut -d'.' -f2) --region $(echo %h|/usr/bin/cut -d'.' -f3) --document-name AWS-StartSSHSession --parameters 'portNumber=%p'" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/pytest-simcore/src/pytest_simcore/aws_iam_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# pylint: disable=redefined-outer-name | ||
# pylint: disable=unused-argument | ||
# pylint: disable=unused-import | ||
|
||
import contextlib | ||
import logging | ||
from collections.abc import AsyncIterator | ||
from typing import cast | ||
|
||
import aioboto3 | ||
import pytest | ||
from aiobotocore.session import ClientCreatorContext | ||
from faker import Faker | ||
from settings_library.ec2 import EC2Settings | ||
from types_aiobotocore_iam.client import IAMClient | ||
|
||
from .helpers.logging_tools import log_context | ||
|
||
|
||
@pytest.fixture | ||
async def iam_client( | ||
ec2_settings: EC2Settings, | ||
) -> AsyncIterator[IAMClient]: | ||
session = aioboto3.Session() | ||
exit_stack = contextlib.AsyncExitStack() | ||
session_client = session.client( | ||
"iam", | ||
endpoint_url=ec2_settings.EC2_ENDPOINT, | ||
aws_access_key_id=ec2_settings.EC2_ACCESS_KEY_ID, | ||
aws_secret_access_key=ec2_settings.EC2_SECRET_ACCESS_KEY, | ||
region_name=ec2_settings.EC2_REGION_NAME, | ||
) | ||
assert isinstance(session_client, ClientCreatorContext) | ||
iam_client = cast(IAMClient, await exit_stack.enter_async_context(session_client)) | ||
|
||
yield iam_client | ||
|
||
await exit_stack.aclose() | ||
|
||
|
||
@pytest.fixture | ||
async def aws_instance_profile( | ||
iam_client: IAMClient, faker: Faker | ||
) -> AsyncIterator[str]: | ||
|
||
profile = await iam_client.create_instance_profile( | ||
InstanceProfileName=faker.pystr(), | ||
) | ||
profile_arn = profile["InstanceProfile"]["Arn"] | ||
with log_context( | ||
logging.INFO, msg=f"Created InstanceProfile in AWS with {profile_arn=}" | ||
): | ||
yield profile_arn | ||
|
||
await iam_client.delete_instance_profile( | ||
InstanceProfileName=profile["InstanceProfile"]["InstanceProfileName"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/pytest-simcore/src/pytest_simcore/helpers/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
# pytest_simcore.docker_compose fixture module config variables | ||
import pytest | ||
|
||
FIXTURE_CONFIG_CORE_SERVICES_SELECTION = "pytest_simcore_core_services_selection" | ||
FIXTURE_CONFIG_OPS_SERVICES_SELECTION = "pytest_simcore_ops_services_selection" | ||
|
||
# NOTE: this ensures that assertion printouts are nicely formated and complete see https://lorepirri.com/pytest-register-assert-rewrite.html | ||
pytest.register_assert_rewrite("pytest_simcore.helpers") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.