Skip to content

Conversation

@ajinkya1986
Copy link
Contributor

No description provided.

@ajinkya1986 ajinkya1986 requested a review from mpurusottamc July 29, 2024 12:28
# Initialize a session using Amazon DynamoDB
session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

'AttributeName': 'PrimaryKey',
'AttributeType': 'S'
}
],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

```

4. The above script will print out the names of all DynamoDB tables that do not have autoscaling enabled. If no output is produced, that means all tables have autoscaling enabled. If there is an error while checking a table, the error message will be printed.
</Accordion>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

# Initialize a session using Amazon DynamoDB
session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

except Exception as e:
print(f"Error enabling continuous backups for table {table}: {e}")
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

print(f"Continuous backup is NOT enabled for {table.name}")
else:
print(f"Continuous backup is NOT enabled for {table.name}")
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

# Initialize a session using Amazon DynamoDB
session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


4. **Check the destination encryption**:
For each delivery stream, use the `describe_delivery_stream` method to get its details and check if the destination encryption is enabled.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

else:
print(f"Stream {stream_name} is not encrypted with a CMK")
else:
print(f"Stream {stream_name} does not have encryption enabled")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

4. Run the script. If a table is encrypted with a KMS Customer Master Key, the script will print the table name and the ARN of the key. If a table is not encrypted with a KMS Customer Master Key, the script will simply print the table name.

Please replace 'YOUR_ACCESS_KEY' and 'YOUR_SECRET_KEY' with your actual AWS access key and secret key. Also, replace 'us-west-2' with the AWS region that you're using.
</Accordion>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details


session = boto3.Session(
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

Please note that this is a simplified example and actual policy parsing might be more complex depending on the policy structure.
</Accordion>

</AccordionGroup>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

</Accordion>

</AccordionGroup>
</Tab>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

2. **Create a DynamoDB resource and client:**
You can create a DynamoDB resource and client using your AWS credentials. Replace 'your_access_key', 'your_secret_key', and 'your_region' with your actual AWS credentials.
```python
dynamodb = boto3.resource('dynamodb', aws_access_key_id='your_access_key', aws_secret_access_key='your_secret_key', region_name='your_region')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

You can create a DynamoDB resource and client using your AWS credentials. Replace 'your_access_key', 'your_secret_key', and 'your_region' with your actual AWS credentials.
```python
dynamodb = boto3.resource('dynamodb', aws_access_key_id='your_access_key', aws_secret_access_key='your_secret_key', region_name='your_region')
client = boto3.client('dynamodb', aws_access_key_id='your_access_key', aws_secret_access_key='your_secret_key', region_name='your_region')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

```python
import boto3

client = boto3.client('sagemaker')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

Then, configure your AWS credentials. You can do this by setting the following environment variables:
```
AWS_ACCESS_KEY_ID = 'your_access_key'
AWS_SECRET_ACCESS_KEY = 'your_secret_key'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secret: Secret Keyword

Click here for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants