aws-cdk

AWS CDK setup appsync with dynamodb table permissions

前提是你 提交于 2021-02-11 06:18:26
问题 I am using the new higher level GraphqlAPI class instead of the lower level constructs to create my Appsync api and connect it to a table. this.api = new GraphqlApi(...); The new GraphqlApi instance allows you to simply add datasources: this.api.addDynamoDbDataSource('name', tableRef); If you look at the example code at https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appsync-readme.html, I notice that they do not create a role to grant permission for Appsync to access the table: const

AWS CDK setup appsync with dynamodb table permissions

余生长醉 提交于 2021-02-11 06:18:26
问题 I am using the new higher level GraphqlAPI class instead of the lower level constructs to create my Appsync api and connect it to a table. this.api = new GraphqlApi(...); The new GraphqlApi instance allows you to simply add datasources: this.api.addDynamoDbDataSource('name', tableRef); If you look at the example code at https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appsync-readme.html, I notice that they do not create a role to grant permission for Appsync to access the table: const

AWS CDK setup appsync with dynamodb table permissions

寵の児 提交于 2021-02-11 06:17:42
问题 I am using the new higher level GraphqlAPI class instead of the lower level constructs to create my Appsync api and connect it to a table. this.api = new GraphqlApi(...); The new GraphqlApi instance allows you to simply add datasources: this.api.addDynamoDbDataSource('name', tableRef); If you look at the example code at https://docs.aws.amazon.com/cdk/api/latest/docs/aws-appsync-readme.html, I notice that they do not create a role to grant permission for Appsync to access the table: const

How to create custom construct library for aws-cdk in python

℡╲_俬逩灬. 提交于 2021-01-29 06:06:27
问题 Recently I have been using aws-cdk to create EC2, VPC and S3 services. But if I want to create my custom EC2 Library in python(not using JSII) than will be using aws_cdk's aws_ec2 library to actually create the EC2 Instance and a VPC. The custom library will accept arguments like Instance Name(String) , InstanceType(String) , MachineImage(String) , Subnet Type (String) Than this arguments will be refer like below: Disclaimer: Code below Might not be correct dummy_ec2 = ec2.Instance(self,

How to perform database schema migrations after deploying with AWS CDK?

痞子三分冷 提交于 2021-01-29 02:34:14
问题 I'm running an Aurora PostgreSQL (Serverless) cluster. After I deploy the infrastructure for the first time, and every time I re-deploy, I want to run database schema migrations (add tables, add columns). How can I accomplish this? Lambda is out of the question, as migrations may run for a long time. Edit : clarified about schema migration Thanks! 回答1: The correct way to migrate it would be through using the AWS Database Migration Service. You could create the resources in the CDK for this,

How to perform database schema migrations after deploying with AWS CDK?

ε祈祈猫儿з 提交于 2021-01-29 02:32:47
问题 I'm running an Aurora PostgreSQL (Serverless) cluster. After I deploy the infrastructure for the first time, and every time I re-deploy, I want to run database schema migrations (add tables, add columns). How can I accomplish this? Lambda is out of the question, as migrations may run for a long time. Edit : clarified about schema migration Thanks! 回答1: The correct way to migrate it would be through using the AWS Database Migration Service. You could create the resources in the CDK for this,

AWS CDK Working with Existing DynamoDB and Streams

允我心安 提交于 2021-01-28 11:43:53
问题 I'm migrating my cloud solution to cdk. I can see how to add a stream to a new DynamoDB in the constructor through the TableProps: const newTable = new dynamodb.Table(this, 'new Table', { tableName: 'streaming', partitionKey: { name : 'id', type: dynamodb.AttributeType.NUMBER }, stream: StreamViewType.NEW_AND_OLD_IMAGES, }) but there is no apparent way to enable a stream on an existing DynamoDB. I can't seem to access the TableProps on an existing item. const sandpitTable = dynamodb.Table

How to enforce standards and controls when using CDK Pipeline

有些话、适合烂在心里 提交于 2021-01-28 11:24:58
问题 CDK Pipelines is great, specially for cross-account deployments. It enables the developers to define and customize the CI/CD pipeline for their app to their heart's content. But to remain SoC compliant, we need to make sure that necessary controls like below are validated/enforced A manual approval stage should be present before the stage that does the cross-account deployment to production Direct deployment to production bypassing dev/staging environment is not allowed Test cases (Unit tests

Why is an admin account getting permission denied when updating a BucketPolicy?

﹥>﹥吖頭↗ 提交于 2021-01-28 08:30:55
问题 I have an AWS CDK script that I'm now unable to deploy. I could deploy it before adding a bucket policy. After adding a bucket policy, it fails to deploy. Here's the Python code: bucket = aws_s3.Bucket( self, "myBucket", bucket_name="mybucket", access_control=aws_s3.BucketAccessControl.PRIVATE, versioned=True, encryption=aws_s3.BucketEncryption.S3_MANAGED, block_public_access=aws_s3.BlockPublicAccess.BLOCK_ALL ) policy_statement = aws_iam.PolicyStatement( effect=aws_iam.Effect.DENY, actions=[

Is there a way of running AWS Step Functions locally when defined by CDK?

无人久伴 提交于 2021-01-28 05:44:42
问题 AWS Step Functions may be run in a local Docker environment using Step Functions Local Docker. However, the step functions need to be defined using the JSON-based Amazon States Language. This is not at all convenient if your AWS infrastructure (Step Functions plus lambdas) is defined using AWS CDK/CloudFormation. Is there a way to create the Amazon States Language definition of a state machine from the CDK or CloudFormation output, such that it’s possible to run the step functions locally? My