aws-secrets-manager

How do I grant a rotation Lambda access to AWS Secrets Manager

非 Y 不嫁゛ 提交于 2020-01-24 13:04:06
问题 Using the serverless framework, I am trying to build a Lambda function that periodically rotates a secret stored in AWS Secrets Manager. I am having trouble configuring the roles needed for the Secret Manager to execute the Lambda. In my serverless.yml I have defined the following resources: resources: Resources: RotateKeysRole: Type: AWS::IAM::Role Properties: RoleName: rotate-keys-role ManagedPolicyArns: - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

How to retrieve Secret Manager data in buildspec.yaml

坚强是说给别人听的谎言 提交于 2020-01-23 12:51:57
问题 Im working on creating the CodeBuild which is integrated with SonarQube, So I pass values and sonar credentials directly in my Buildspec.yaml Instead of Hardcoding directly, I tried to retrieve using the below command from SecretManager as it is mentioned in the below link. But it is not getting the correct values. it throws an error. Command : '{{resolve:secretsmanager:MyRDSSecret:SecretString:username}}' Link : https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic

Using AWS Secrets Manager with Python (Lambda Console)

你。 提交于 2020-01-02 05:13:11
问题 I am attempting to use Secrets Manager a Lambda function in AWS. Secrets a manager is used to store database credentials to Snowflake (username, password). I managed to set up a secret in Secrets Manager which contains several key/value pairs (e.g. one for username, another for password). Now I am trying to refer to these values in my Python function code. AWS documentation kindly provides the following snippet: import boto3 import base64 from botocore.exceptions import ClientError def get

Reading a secret using CloudFormation

自作多情 提交于 2019-12-11 04:32:41
问题 I am trying to create an AWS stack in CloudFormation having a secret in the JSON. I don't want the value of the secret displayed in the parameters and I don't want my instance (fargate or ec2) to access the secrets manager. I want CloudFormation to retrieve the value from the secrets manager and inject it in the template during runtime. This is what I did: Create a secret Create a template using Designer Read the secret and create a resource. In this case I am creating a bucket that has as a

Dynamic References to Specify Secret Manager Values in AWS Cloudformation

ぃ、小莉子 提交于 2019-12-03 08:36:48
Is there anyway we can pass dynamic references to Secret Manager to AWS Launch Config User Data? Here is the code snippet I tried: "SampleLaunchConfig": { "Type": "AWS::AutoScaling::LaunchConfiguration", "Properties": { "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" }, "AMI" ] }, "UserData": { "Fn::Base64": { "Fn::Join": [ "", [ "#!/bin/bash -xe\n", "yum update -y\n", "useradd -p <<pwd>>{{resolve:secretsmanager:Credentials:SecretString:userName}}\n", "\n" ] ] } } } } Seems error in getting the useradd: invalid user name '{{resolve:secretsmanager:Credentials

Dynamic References to Specify Secret Manager Values in AWS Cloudformation

穿精又带淫゛_ 提交于 2019-11-29 15:57:48
问题 Is there anyway we can pass dynamic references to Secret Manager to AWS Launch Config User Data? Here is the code snippet I tried: "SampleLaunchConfig": { "Type": "AWS::AutoScaling::LaunchConfiguration", "Properties": { "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" }, "AMI" ] }, "UserData": { "Fn::Base64": { "Fn::Join": [ "", [ "#!/bin/bash -xe\n", "yum update -y\n", "useradd -p <<pwd>>{{resolve:secretsmanager:Credentials:SecretString:userName}}\n", "\n" ] ] } }