-
-
Save josjaf/6151bbb88063b7c030182cbb6364a7ac to your computer and use it in GitHub Desktop.
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
from aws_cdk import ( | |
aws_iam as aws_iam, | |
aws_s3 as aws_s3, | |
aws_ecr, | |
aws_ec2, | |
core, | |
) | |
class Compute(core.Stack): | |
def __init__(self, app: core.App, id: str, props, **kwargs) -> None: | |
super().__init__(app, id, **kwargs) | |
# creating a role manually because the instance class does not exist | |
ec2_role = aws_iam.Role( | |
self, "A", | |
assumed_by=aws_iam.CompositePrincipal( | |
aws_iam.ServicePrincipal('ec2.amazonaws.com'), | |
aws_iam.ServicePrincipal('ssm.amazonaws.com'), | |
aws_iam.AccountRootPrincipal() | |
), | |
max_session_duration=core.Duration.hours(1), | |
managed_policies=[aws_iam.ManagedPolicy.from_aws_managed_policy_name('AmazonSSMManagedInstanceCore')], | |
# | |
) | |
props.ec2_role = ec2_role | |
self.output_props = props | |
@property | |
def outputs(self): | |
props = self.output_props | |
return props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment