3 ms·
It's funny to me why people aren't aware of CDK. It's literally no different than writing code. You don't have to depend on anyone, you can customize this to no
by tomatowurst 4y ago
It's funny to me why people aren't aware of CDK. It's literally no different than writing code. You don't have to depend on anyone, you can customize this to no end, its part of your codebase.
from aws_cdk import aws_s3 as s3,naws_iam as iam,bcore
class S3Template(core.Stack):
def __init__(self, app: core.App, id: str, **kwargs) -> None:
super().__init__(app, id)
myBucket = s3.Bucket(self, 'MyFirstBucket',
bucket_name='balkaran-aws-cdk-s3-demo-bucket')
myBucket.add_to_resource_policy(
iam.PolicyStatement(
actions=['s3:GetObject'],
resources=
[myBucket.arn_for_objects('*')],
principals=
[iam.AccountPrincipal(account_id=core.Aws.ACCOUNT_ID)]
)
)
myUser = iam.User(self,'s3User')
myBucket.grant_write(myUser)
app = core.App()
S3Template(app, "S3Template", env={'region':'us-east-1'})
app.synth()
- battle_hardened 4y agoCareful, sarcasm is hard to detect online
- tomatowurst 4y agoare you sure you can offline?