Python | Lambda | Decrypt EFS data and send to S3












1















Hi I am looking for a start of Python Lambda function which will decrypt data from EFS and send it to S3 bucket.



https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/efs.html



I looked this link but i don't think any methods mentioned are helpful. Please suggest where I can start writing this.



My code currently assumes that, it receives encrypted file which will then decrypt it using gnupg and send the file back to S3.



But this doesn't fulfil my complete requirement - when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The Lambda function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.



import boto3
import gnupg

# Create an S3 client
s3 = boto3.client('s3')

def lambda_handler(event, context):
Key = "/efs/iamfile.txt"
stream = open(Key, "rb")
decrypted_data = gpg.decrypt_file(stream)
bucketName = "op-efs-uki-vpc"
outPutname = "decrypted_data"
s3 = boto3.client('s3')
s3.upload_file(Key,bucketName,outPutname)









share|improve this question

























  • Why do you need lambda function?

    – betontalpfa
    Nov 26 '18 at 15:29













  • @betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

    – user10664125
    Nov 26 '18 at 15:36











  • @betontalpfa- What options do we have more?

    – user10664125
    Nov 26 '18 at 15:36













  • @HBruijn - Could you please suggest me here

    – user10664125
    Nov 27 '18 at 19:17











  • What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

    – cosmic_inquiry
    Nov 27 '18 at 22:16
















1















Hi I am looking for a start of Python Lambda function which will decrypt data from EFS and send it to S3 bucket.



https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/efs.html



I looked this link but i don't think any methods mentioned are helpful. Please suggest where I can start writing this.



My code currently assumes that, it receives encrypted file which will then decrypt it using gnupg and send the file back to S3.



But this doesn't fulfil my complete requirement - when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The Lambda function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.



import boto3
import gnupg

# Create an S3 client
s3 = boto3.client('s3')

def lambda_handler(event, context):
Key = "/efs/iamfile.txt"
stream = open(Key, "rb")
decrypted_data = gpg.decrypt_file(stream)
bucketName = "op-efs-uki-vpc"
outPutname = "decrypted_data"
s3 = boto3.client('s3')
s3.upload_file(Key,bucketName,outPutname)









share|improve this question

























  • Why do you need lambda function?

    – betontalpfa
    Nov 26 '18 at 15:29













  • @betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

    – user10664125
    Nov 26 '18 at 15:36











  • @betontalpfa- What options do we have more?

    – user10664125
    Nov 26 '18 at 15:36













  • @HBruijn - Could you please suggest me here

    – user10664125
    Nov 27 '18 at 19:17











  • What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

    – cosmic_inquiry
    Nov 27 '18 at 22:16














1












1








1








Hi I am looking for a start of Python Lambda function which will decrypt data from EFS and send it to S3 bucket.



https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/efs.html



I looked this link but i don't think any methods mentioned are helpful. Please suggest where I can start writing this.



My code currently assumes that, it receives encrypted file which will then decrypt it using gnupg and send the file back to S3.



But this doesn't fulfil my complete requirement - when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The Lambda function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.



import boto3
import gnupg

# Create an S3 client
s3 = boto3.client('s3')

def lambda_handler(event, context):
Key = "/efs/iamfile.txt"
stream = open(Key, "rb")
decrypted_data = gpg.decrypt_file(stream)
bucketName = "op-efs-uki-vpc"
outPutname = "decrypted_data"
s3 = boto3.client('s3')
s3.upload_file(Key,bucketName,outPutname)









share|improve this question
















Hi I am looking for a start of Python Lambda function which will decrypt data from EFS and send it to S3 bucket.



https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/efs.html



I looked this link but i don't think any methods mentioned are helpful. Please suggest where I can start writing this.



My code currently assumes that, it receives encrypted file which will then decrypt it using gnupg and send the file back to S3.



But this doesn't fulfil my complete requirement - when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The Lambda function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.



import boto3
import gnupg

# Create an S3 client
s3 = boto3.client('s3')

def lambda_handler(event, context):
Key = "/efs/iamfile.txt"
stream = open(Key, "rb")
decrypted_data = gpg.decrypt_file(stream)
bucketName = "op-efs-uki-vpc"
outPutname = "decrypted_data"
s3 = boto3.client('s3')
s3.upload_file(Key,bucketName,outPutname)






python python-3.x amazon-s3 gnupg amazon-efs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 18:43

























asked Nov 26 '18 at 12:08







user10664125




















  • Why do you need lambda function?

    – betontalpfa
    Nov 26 '18 at 15:29













  • @betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

    – user10664125
    Nov 26 '18 at 15:36











  • @betontalpfa- What options do we have more?

    – user10664125
    Nov 26 '18 at 15:36













  • @HBruijn - Could you please suggest me here

    – user10664125
    Nov 27 '18 at 19:17











  • What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

    – cosmic_inquiry
    Nov 27 '18 at 22:16



















  • Why do you need lambda function?

    – betontalpfa
    Nov 26 '18 at 15:29













  • @betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

    – user10664125
    Nov 26 '18 at 15:36











  • @betontalpfa- What options do we have more?

    – user10664125
    Nov 26 '18 at 15:36













  • @HBruijn - Could you please suggest me here

    – user10664125
    Nov 27 '18 at 19:17











  • What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

    – cosmic_inquiry
    Nov 27 '18 at 22:16

















Why do you need lambda function?

– betontalpfa
Nov 26 '18 at 15:29







Why do you need lambda function?

– betontalpfa
Nov 26 '18 at 15:29















@betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

– user10664125
Nov 26 '18 at 15:36





@betontalpfa-- A File decryption lambda function is executed when a new file lands to the EFS. This can use Cloudwatch events when the final trigger file is copied.The function picks up the encrypted file, decrypts them, adds the required metadata and sends them to the S3 bucket.

– user10664125
Nov 26 '18 at 15:36













@betontalpfa- What options do we have more?

– user10664125
Nov 26 '18 at 15:36







@betontalpfa- What options do we have more?

– user10664125
Nov 26 '18 at 15:36















@HBruijn - Could you please suggest me here

– user10664125
Nov 27 '18 at 19:17





@HBruijn - Could you please suggest me here

– user10664125
Nov 27 '18 at 19:17













What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

– cosmic_inquiry
Nov 27 '18 at 22:16





What is the required metadata? Have you looked at: boto3.amazonaws.com/v1/documentation/api/latest/reference/…

– cosmic_inquiry
Nov 27 '18 at 22:16












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53480817%2fpython-lambda-decrypt-efs-data-and-send-to-s3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53480817%2fpython-lambda-decrypt-efs-data-and-send-to-s3%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks