id stringlengths 14 16 | text stringlengths 1 2.43k | source stringlengths 99 229 |
|---|---|---|
ab30d41f888a-0 | ```
new CfnResource(this, "MyBucket", new CfnResourceProps
{
Type = "AWS::S3::Bucket",
Properties = new Dictionary<string, object>
{ // Note the PascalCase here! These are CloudFormation identifiers
["AnalyticsConfigurations"] = new List<Dictionary<string, string>>
{
new Dictionary<string, string> {
["Id"] = "Config"... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
4438b10ef926-0 | If a Construct is missing a feature or you are trying to work around an issue, you can modify the CFN Resource that is encapsulated by the Construct\.
All Constructs contain within them the corresponding CFN Resource\. For example, the high\-level `Bucket` construct wraps the low\-level `CfnBucket` construct\. Becaus... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
a1b7d8c4ab79-0 | ```
// Get the AWS CloudFormation resource
const cfnBucket = bucket.node.defaultChild as s3.CfnBucket;
// Change its properties
cfnBucket.analyticsConfiguration = [
{
id: 'Config',
// ...
}
];
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
25181dcd6cc9-0 | ```
// Get the AWS CloudFormation resource
const cfnBucket = bucket.node.defaultChild;
// Change its properties
cfnBucket.analyticsConfiguration = [
{
id: 'Config'
// ...
}
];
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
8f4780f637c9-0 | ``` | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
2780ac768acc-0 | cfn_bucket = bucket.node.default_child | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
2ed3e9a872af-0 | cfn_bucket.analytics_configuration = [
{
"id": "Config", | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
5447f36c3183-0 | }
]
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
b54a23c2816e-0 | ```
// Get the AWS CloudFormation resource
CfnBucket cfnBucket = (CfnBucket)bucket.getNode().getDefaultChild();
cfnBucket.setAnalyticsConfigurations(
Arrays.asList(new HashMap<String, String>() {{
put("Id", "Config");
// ...
}}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
a4285dddd564-0 | ```
// Get the AWS CloudFormation resource
var cfnBucket = (CfnBucket)bucket.Node.DefaultChild;
cfnBucket.AnalyticsConfigurations = new List<object> {
new Dictionary<string, string>
{
["Id"] = "Config",
// ...
}
};
```
------
You can also use this object to change AWS CloudFormation options such as `Metadata` and... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
bf607cd6507d-0 | ```
cfnBucket.cfnOptions.metadata = {
MetadataKey: 'MetadataValue'
};
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
fc724aaa19fd-0 | ```
cfnBucket.cfnOptions.metadata = {
MetadataKey: 'MetadataValue'
};
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
3a3f37dd4d37-0 | ```
cfn_bucket.cfn_options.metadata = {
"MetadataKey": "MetadataValue"
}
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
df62e40f16ab-0 | ```
cfnBucket.getCfnOptions().setMetadata(new HashMap<String, Object>() {{
put("MetadataKey", "Metadatavalue");
}});
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
16d0549217ca-0 | ```
cfnBucket.CfnOptions.Metadata = new Dictionary<string, object>
{
["MetadataKey"] = "Metadatavalue"
};
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
951eeab7f484-0 | If there are properties that are missing from the CFN Resource, you can bypass all typing using raw overrides\. This also makes it possible to delete synthesized properties\.
Use one of the `addOverride` methods \(Python: `add_override`\) methods, as shown in the following example\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
dec224be24ba-0 | ```
// Get the AWS CloudFormation resource
const cfnBucket = bucket.node.defaultChild as s3.CfnBucket;
// Use dot notation to address inside the resource template fragment
cfnBucket.addOverride('Properties.VersioningConfiguration.Status', 'NewStatus');
cfnBucket.addDeletionOverride('Properties.VersioningConfiguration... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
d9249555b731-0 | ```
// Get the AWS CloudFormation resource
const cfnBucket = bucket.node.defaultChild ;
// Use dot notation to address inside the resource template fragment
cfnBucket.addOverride('Properties.VersioningConfiguration.Status', 'NewStatus');
cfnBucket.addDeletionOverride('Properties.VersioningConfiguration.Status');
//... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
90edc62a90f0-0 | ``` | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
127c9e1f801a-0 | cfn_bucket = bucket.node.default_child | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
e70d0c23296a-0 | cfn_bucket.add_override("Properties.VersioningConfiguration.Status", "NewStatus")
cfn_bucket.add_deletion_override("Properties.VersioningConfiguration.Status") | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
79ea32793623-0 | cfn_bucket.add_property_override("VersioningConfiguration.Status", "NewStatus")
cfn_bucket.add_property_deletion_override("VersioningConfiguration.Status")
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
442fd1fc79f1-0 | ```
// Get the AWS CloudFormation resource
CfnBucket cfnBucket = (CfnBucket)bucket.getNode().getDefaultChild();
// Use dot notation to address inside the resource template fragment
cfnBucket.addOverride("Properties.VersioningConfiguration.Status", "NewStatus");
cfnBucket.addDeletionOverride("Properties.VersioningConf... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
fe9fdb34d742-0 | ```
// Get the AWS CloudFormation resource
var cfnBucket = (CfnBucket)bucket.node.defaultChild;
// Use dot notation to address inside the resource template fragment
cfnBucket.AddOverride("Properties.VersioningConfiguration.Status", "NewStatus");
cfnBucket.AddDeletionOverride("Properties.VersioningConfiguration.Status... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
1ef6219cf72d-0 | If the feature isn't available through AWS CloudFormation, but only through a direct API call, the only solution is to write an AWS CloudFormation Custom Resource to make the API call you need\. Don't worry, the AWS CDK makes it easier to write these, and wrap them up into a regular construct interface, so from another... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
1ef6219cf72d-1 | + For a more fully fledged example, see the [DnsValidatedCertificate](https://github.com/awslabs/aws-cdk/blob/master/packages/@aws-cdk/aws-certificatemanager/lib/dns-validated-certificate.ts) class in the CDK standard library\. This is implemented as a custom resource\. | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/cfn_layer.md |
e7cbfcd302e5-0 | The AWS Construct Library uses a few common, widely\-implemented idioms to manage access and permissions\. The IAM module provides you with the tools you need to use these idioms\. | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
7eeec7ca004e-0 | An IAM principal is an entity that can be authenticated in order to access AWS resources, such as a user, a service, or an application\. The AWS Construct Library supports many types of principals, including:
1. IAM resources such as `[Role](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html)`... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
7eeec7ca004e-1 | 1. Account principals \(`new iam.[AccountPrincipal](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.AccountPrincipal.html)('0123456789012'))`
1. Canonical user principals \(`new iam.[CanonicalUserPrincipal](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.CanonicalUserPrincipal.html)(... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
7eeec7ca004e-2 | 1. An `iam.[CompositePrincipal](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.CompositePrincipal.html)(principal1, principal2, ...)` to trust multiple principals | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
2a454718b5ab-0 | Every construct that represents a resource that can be accessed, such as an Amazon S3 bucket or Amazon DynamoDB table, has methods that grant access to another entity\. All such methods have names starting with **grant**\. For example, Amazon S3 buckets have the methods `[grantRead](https://docs.aws.amazon.com/cdk/api/... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
2a454718b5ab-1 | The first argument of a **grant** method is always of type [IGrantable](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.IGrantable.html)\. This interface represents entities that can be granted permissions—that is, resources with roles, such as the IAM objects `[Role](https://docs.aws.amazon.com/cdk/ap... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
2a454718b5ab-2 | Resources that use execution roles, such as `[lambda\.Function](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Function.html)`, also implement `IGrantable`, so you can grant them access directly instead of granting access to their role\. For example, if `bucket` is an Amazon S3 bucket, and `functio... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
67ac0d861a6b-0 | ```
bucket.grantRead(function);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
0d420e9b7509-0 | ```
bucket.grantRead(function);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
3f67f82aa8e3-0 | ```
bucket.grant_read(function)
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
fa6eae355413-0 | ```
bucket.grantRead(function);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
fc4489fe3ade-0 | ```
bucket.GrantRead(function);
```
------
Sometimes permissions must be applied while your stack is being deployed\. One such case is when you grant a AWS CloudFormation custom resource access to some other resource\. The custom resource will be invoked during deployment, so it must have the specified permissions ... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
414d0aaa8503-0 | ```
const grant = bucket.grantRead(lambda);
const custom = new CustomResource(...);
custom.node.addDependency(grant);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
c77ce2bf9fd0-0 | ```
const grant = bucket.grantRead(lambda);
const custom = new CustomResource(...);
custom.node.addDependency(grant);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
8a641dfa2cb3-0 | ```
grant = bucket.grant_read(function)
custom = CustomResource(...)
custom.node.add_dependency(grant)
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
b70d56158af6-0 | ```
Grant grant = bucket.grantRead(function);
CustomResource custom = new CustomResource(...);
custom.node.addDependency(grant);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
46d5f2a790ef-0 | ```
var grant = bucket.GrantRead(function);
var custom = new CustomResource(...);
custom.node.AddDependency(grant);
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
099f1533c3d4-0 | The IAM package contains a `[Role](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html)` construct that represents IAM roles\. The following code creates a new role, trusting the Amazon EC2 service\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
bdb1935e01e8-0 | ```
import * as iam from '@aws-cdk/aws-iam';
const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'), // required
});
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
736ccf07efd4-0 | ```
const iam = require('@aws-cdk/aws-iam');
const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com') // required
});
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
c8c67096978f-0 | ```
import aws_cdk.aws_iam as iam
role = iam.Role(self, "Role",
assumed_by=iam.ServicePrincipal("ec2.amazonaws.com")) # required
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
b4e2d9359fee-0 | ```
import software.amazon.awscdk.services.iam.Role;
import software.amazon.awscdk.services.iam.ServicePrincipal;
Role role = Role.Builder.create(this, "Role")
.assumedBy(new ServicePrincipal("ec2.amazonaws.com")).build();
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
f465d66ea5fb-0 | ```
using Amazon.CDK.AWS.IAM;
var role = new Role(this, "Role", new RoleProps
{
AssumedBy = new ServicePrincipal("ec2.amazonaws.com"), // required
});
```
------
You can add permissions to a role by calling the role's `[addToPolicy](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html#add-... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
0d41c3679a19-0 | ```
role.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.DENY,
resources: [bucket.bucketArn, otherRole.roleArn],
actions: ['ec2:SomeAction', 's3:AnotherAction'],
conditions: {StringEquals: {
'ec2:AuthorizedService': 'codebuild.amazonaws.com',
}}}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
9558730b92fd-0 | ```
role.addToPolicy(new iam.PolicyStatement({
effect: iam.Effect.DENY,
resources: [bucket.bucketArn, otherRole.roleArn],
actions: ['ec2:SomeAction', 's3:AnotherAction'],
conditions: {StringEquals: {
'ec2:AuthorizedService': 'codebuild.amazonaws.com'
}}}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
284945bc3cd4-0 | ```
role.add_to_policy(iam.PolicyStatement(
effect=iam.Effect.DENY,
resources=[bucket.bucket_arn, other_role.role_arn],
actions=["ec2:SomeAction", "s3:AnotherAction"],
conditions={"StringEquals": {
"ec2:AuthorizedService": "codebuild.amazonaws.com"}}
))
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
eda344d21028-0 | ```
role.addToPolicy(PolicyStatement.Builder.create()
.effect(Effect.DENY)
.resources(Arrays.asList(bucket.getBucketArn(), otherRole.getRoleArn()))
.actions(Arrays.asList("ec2:SomeAction", "s3:AnotherAction"))
.conditions(new HashMap<String, Object>() {{
put("StringEquals", new HashMap<String, String>() {{
put("ec2:Aut... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
feb380c83d9a-0 | ```
role.AddToPolicy(new PolicyStatement(new PolicyStatementProps
{
Effect = Effect.DENY,
Resources = new string[] { bucket.BucketArn, otherRole.RoleArn },
Actions = new string[] { "ec2:SomeAction", "s3:AnotherAction" },
Conditions = new Dictionary<string, object>
{
["StringEquals"] = new Dictionary<string, string>
{
[... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
feb380c83d9a-1 | }
}
}));
```
------
In our example above, we've created a new `[PolicyStatement](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.PolicyStatement.html)` inline with the `[addToPolicy](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.Role.html#add-to-policystatement)` \(Python: `add_t... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
2c3bd177ccbc-0 | ```
import * as codebuild from '@aws-cdk/aws-codebuild';
// imagine roleOrUndefined is a function that might return a Role object
// under some conditions, and undefined under other conditions
const someRole: iam.IRole | undefined = roleOrUndefined();
const project = new codebuild.Project(this, 'Project', {
// if s... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
0696a90945c7-0 | ```
const codebuild = require('@aws-cdk/aws-codebuild');
// imagine roleOrUndefined is a function that might return a Role object
// under some conditions, and undefined under other conditions
const someRole = roleOrUndefined();
const project = new codebuild.Project(this, 'Project', {
// if someRole is undefined, t... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
c42ee442dc53-0 | ```
import aws_cdk.aws_codebuild as codebuild | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
92ab74cc97e1-0 | some_role = role_or_none();
project = codebuild.Project(self, "Project", | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
d69f9886f2d5-0 | role=some_role)
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
a3e85c228664-0 | ```
import software.amazon.awscdk.services.iam.Role;
import software.amazon.awscdk.services.codebuild.Project;
// imagine roleOrNull is a function that might return a Role object
// under some conditions, and null under other conditions
Role someRole = roleOrNull();
// if someRole is null, the Project creates a new... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
d59124bd96bc-0 | ```
using Amazon.CDK.AWS.CodeBuild;
// imagine roleOrNull is a function that might return a Role object
// under some conditions, and null under other conditions
var someRole = roleOrNull();
// if someRole is null, the Project creates a new default role,
// trusting the codebuild.amazonaws.com service principal
var... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
f7d225f362b7-0 | ```
// project is imported into the CDK application
const project = codebuild.Project.fromProjectName(this, 'Project', 'ProjectName');
// project is imported, so project.role is undefined, and this call has no effect
project.addToRolePolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW, // ... and so on defini... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
22b4561b1c4b-0 | ```
// project is imported into the CDK application
const project = codebuild.Project.fromProjectName(this, 'Project', 'ProjectName');
// project is imported, so project.role is undefined, and this call has no effect
project.addToRolePolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW // ... and so on definin... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
f71b5ca4966e-0 | ``` | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
759d53d7665a-0 | project = codebuild.Project.from_project_name(self, 'Project', 'ProjectName') | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
7aba98e4d25d-0 | project.add_to_role_policy(iam.PolicyStatement(
effect=iam.Effect.ALLOW, # ... and so on defining the policy
)
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
4fa2967b4659-0 | ```
// project is imported into the CDK application
Project project = Project.fromProjectName(this, "Project", "ProjectName");
// project is imported, so project.getRole() is null, and this call has no effect
project.addToRolePolicy(PolicyStatement.Builder.create()
.effect(Effect.ALLOW) // .. and so on defining the... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
902cd198389c-0 | ```
// project is imported into the CDK application
var project = Project.FromProjectName(this, "Project", "ProjectName");
// project is imported, so project.role is null, and this call has no effect
project.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps
{
Effect = Effect.ALLOW, // ... and so on definin... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
749f94b18459-0 | A few resources in AWS, such as Amazon S3 buckets and IAM roles, also have a resource policy\. These constructs have an `addToResourcePolicy` method \(Python: `add_to_resource_policy`\), which takes a `[PolicyStatement](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-iam.PolicyStatement.html)` as its argum... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
08e69657aefd-0 | ```
bucket.addToResourcePolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['s3:SomeAction'],
resources: [bucket.bucketArn],
principals: [role]
}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
009de1adf413-0 | ```
bucket.addToResourcePolicy(new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: ['s3:SomeAction'],
resources: [bucket.bucketArn],
principals: [role]
}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
4e19863af438-0 | ```
bucket.add_to_resource_policy(iam.PolicyStatement(
effect=iam.Effect.ALLOW,
actions=["s3:SomeAction"],
resources=[bucket.bucket_arn],
principals=role))
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
d9757185987f-0 | ```
bucket.addToResourcePolicy(PolicyStatement.Builder.create()
.effect(Effect.ALLOW)
.actions(Arrays.asList("s3:SomeAction"))
.resources(Arrays.asList(bucket.getBucketArn()))
.principals(Arrays.asList(role))
.build());
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
5807916f232e-0 | ```
bucket.AddToResourcePolicy(new PolicyStatement(new PolicyStatementProps
{
Effect = Effect.ALLOW,
Actions = new string[] { "s3:SomeAction" },
Resources = new string[] { bucket.BucketArn },
Principals = new IPrincipal[] { role }
}));
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/permissions.md |
fe8de5de10cc-0 | You can specify a context variable either as part of an AWS CDK CLI command, or in `cdk.json`\.
To create a command line context variable, use the **\-\-context** \(**\-c**\) option, as shown in the following example\.
```
cdk synth -c bucket_name=mygroovybucket
```
To specify the same context variable and value ... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
1fdb509f826a-0 | ```
const bucket_name = this.node.tryGetContext('bucket_name');
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
575c6be1e1c7-0 | ```
const bucket_name = this.node.tryGetContext('bucket_name');
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
0ee9a90ec4be-0 | ```
bucket_name = self.node.try_get_context("bucket_name")
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
2dfd92461376-0 | ```
String bucketName = (String)this.getNode().tryGetContext("bucket_name");
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
443e0b660a86-0 | ```
var bucketName = this.Node.TryGetContext("bucket_name");
```
------
Outside the context of a construct, you can access the context variable from the app object, like this\.
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
0feed2c0db13-0 | ```
const app = new cdk.App();
const bucket_name = app.node.tryGetContext('bucket_name')
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
55f6735dd904-0 | ```
const app = new cdk.App();
const bucket_name = app.node.tryGetContext('bucket_name');
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
6f48008667a7-0 | ```
app = cdk.App()
bucket_name = app.node.try_get_context("bucket_name")
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
3c39bb76387d-0 | ```
App app = App();
String bucketName = (String)app.getNode().tryGetContext("bucket_name");
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
c2a7b19b5be5-0 | ```
app = App();
var bucketName = app.Node.TryGetContext("bucket_name");
```
------
For more details on working with context variables, see [Runtime context](context.md)\. | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/get_context_var.md |
6f60c5cb298a-0 | The AWS CDK follows the [shared responsibility model](https://aws.amazon.com/compliance/shared-responsibility-model/) through the specific Amazon Web Services \(AWS\) services it supports\. For AWS service security information, see the [AWS service security documentation page](https://docs.aws.amazon.com/security/?id=d... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/compliance-validation.md |
6f60c5cb298a-1 | For more information about AWS compliance programs, see [AWS Compliance Programs](https://aws.amazon.com/compliance/programs/)\.
Your compliance responsibility when using the AWS CDK to access an AWS service is determined by the sensitivity of your data, your organization's compliance objectives, and applicable laws ... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/compliance-validation.md |
6f60c5cb298a-2 | + [AWS Security Hub](https://aws.amazon.com/security-hub/) – A comprehensive view of your security state within AWS that helps you check your compliance with security industry standards and best practices\. | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/compliance-validation.md |
99b9759fc58c-0 | The AWS CDK deals with many types of identifiers and names\. To use the AWS CDK effectively and avoid errors, you need to understand the types of identifiers\.
Identifiers must be unique within the scope in which they are created; they do not need to be globally unique in your AWS CDK application\.
If you attempt t... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
dd3b1e6219e6-0 | The most common identifier, `id`, is the identifier passed as the second argument when instantiating a construct object\. This identifier, like all identifiers, need only be unique within the scope in which it is created, which is the first argument when instantiating a construct object\.
**Note**
The `id` of a stack... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
877913da6cf6-0 | ```
import { App, Construct, Stack, StackProps } from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
class MyStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps = {}) {
super(scope, id, props);
new s3.Bucket(this, 'MyBucket');
}
}
const app = new App();
new MyStack(app, 'Sta... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
1216b695ef2f-0 | ```
const { App , Stack } = require('@aws-cdk/core');
const s3 = require('@aws-cdk/aws-s3');
class MyStack extends Stack {
constructor(scope, id, props = {}) {
super(scope, id, props);
new s3.Bucket(this, 'MyBucket');
}
}
const app = new App();
new MyStack(app, 'Stack1');
new MyStack(app, 'Stack2');
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
76b829f7e507-0 | ```
from aws_cdk.core import App, Construct, Stack, StackProps
from aws_cdk import aws_s3 as s3
class MyStack(Stack):
def __init__(self, scope: Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
s3.Bucket(self, "MyBucket")
app = App()
MyStack(app, 'Stack1')
MyStack(app, 'Stack2')
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
2398724f3a6e-0 | ```
// MyStack.java
package com.myorg;
import software.amazon.awscdk.core.App;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import software.amazon.awscdk.services.s3.Bucket;
public class MyStack extends Stack {
public MyStack(final App scope, final String id) {
this(scope... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
c5311eca8c66-0 | ```
using core = Amazon.CDK;
using s3 = Amazon.CDK.AWS.S3;
public class MyStack : core.Stack
{
public MyStack(core.App scope, string id, core.IStackProps props) : base(scope, id, props)
{
new s3.Bucket(this, "MyBucket");
}
}
class Program
{
static void Main(string[] args)
{
var app = new core.App();
new MyStack(app... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
067c661ff761-0 | The constructs in an AWS CDK application form a hierarchy rooted in the `App` class\. We refer to the collection of IDs from a given construct, its parent construct, its grandparent, and so on to the root of the construct tree, as a *path*\.
The AWS CDK typically displays paths in your templates as a string, with the... | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
1543b7a03561-0 | ```
const path: string = myConstruct.node.path;
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
ec3530c2b246-0 | ```
const path = myConstruct.node.path;
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
757f0ed9d057-0 | ```
path = my_construct.node.path
```
------ | https://github.com/siagholami/aws-documentation/tree/main/documents/aws-cdk-guide/doc_source/identifiers.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.