aws snapshot for backup using cloudfromation











up vote
1
down vote

favorite












I am currently working on a CloudFormation project to build a fault tolerance architecture. I got a problem with the snapshot. I was trying to use EBS snapshot to store the data, so when one instance is down, other instance can load the data from the snapshot by autoscaling. Can anyone give some ideas, please?



Is the SnapshotId written by ourselves, why it is not visible in the console after creating the stack?



LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-33f92051
InstanceType: t2.micro
AssociatePublicIpAddress: 'true' #auto-assign public ip
KeyName:
Ref: KeyName
SecurityGroups:
- Ref: PublicEC2instancesSecurityGroupJing
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
SnapshotId: snap-0821cc7c34fcb7b01
VolumeSize: 8
UserData:
Fn::Base64:
Fn::Join:
- "n"
- - "#!/bin/bash -xe"
- sudo yum update -y
- sudo yum install httpd24 php56 php56-mysqlnd -y
- sudo yum install mysql -y
- sudo service httpd start
- echo "<html><body><h1>Testing page !!!</h1>" >> /var/www/html/index.html
- echo "</body></html>" >> /var/www/html/index.html









share|improve this question
























  • You cannot attached an EBS volume to two instances. Rather look at using EFS.
    – George Rushby
    Oct 10 at 13:14












  • I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
    – Jing Zhang
    Oct 13 at 21:22















up vote
1
down vote

favorite












I am currently working on a CloudFormation project to build a fault tolerance architecture. I got a problem with the snapshot. I was trying to use EBS snapshot to store the data, so when one instance is down, other instance can load the data from the snapshot by autoscaling. Can anyone give some ideas, please?



Is the SnapshotId written by ourselves, why it is not visible in the console after creating the stack?



LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-33f92051
InstanceType: t2.micro
AssociatePublicIpAddress: 'true' #auto-assign public ip
KeyName:
Ref: KeyName
SecurityGroups:
- Ref: PublicEC2instancesSecurityGroupJing
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
SnapshotId: snap-0821cc7c34fcb7b01
VolumeSize: 8
UserData:
Fn::Base64:
Fn::Join:
- "n"
- - "#!/bin/bash -xe"
- sudo yum update -y
- sudo yum install httpd24 php56 php56-mysqlnd -y
- sudo yum install mysql -y
- sudo service httpd start
- echo "<html><body><h1>Testing page !!!</h1>" >> /var/www/html/index.html
- echo "</body></html>" >> /var/www/html/index.html









share|improve this question
























  • You cannot attached an EBS volume to two instances. Rather look at using EFS.
    – George Rushby
    Oct 10 at 13:14












  • I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
    – Jing Zhang
    Oct 13 at 21:22













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am currently working on a CloudFormation project to build a fault tolerance architecture. I got a problem with the snapshot. I was trying to use EBS snapshot to store the data, so when one instance is down, other instance can load the data from the snapshot by autoscaling. Can anyone give some ideas, please?



Is the SnapshotId written by ourselves, why it is not visible in the console after creating the stack?



LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-33f92051
InstanceType: t2.micro
AssociatePublicIpAddress: 'true' #auto-assign public ip
KeyName:
Ref: KeyName
SecurityGroups:
- Ref: PublicEC2instancesSecurityGroupJing
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
SnapshotId: snap-0821cc7c34fcb7b01
VolumeSize: 8
UserData:
Fn::Base64:
Fn::Join:
- "n"
- - "#!/bin/bash -xe"
- sudo yum update -y
- sudo yum install httpd24 php56 php56-mysqlnd -y
- sudo yum install mysql -y
- sudo service httpd start
- echo "<html><body><h1>Testing page !!!</h1>" >> /var/www/html/index.html
- echo "</body></html>" >> /var/www/html/index.html









share|improve this question















I am currently working on a CloudFormation project to build a fault tolerance architecture. I got a problem with the snapshot. I was trying to use EBS snapshot to store the data, so when one instance is down, other instance can load the data from the snapshot by autoscaling. Can anyone give some ideas, please?



Is the SnapshotId written by ourselves, why it is not visible in the console after creating the stack?



LaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-33f92051
InstanceType: t2.micro
AssociatePublicIpAddress: 'true' #auto-assign public ip
KeyName:
Ref: KeyName
SecurityGroups:
- Ref: PublicEC2instancesSecurityGroupJing
BlockDeviceMappings:
- DeviceName: "/dev/xvda"
Ebs:
SnapshotId: snap-0821cc7c34fcb7b01
VolumeSize: 8
UserData:
Fn::Base64:
Fn::Join:
- "n"
- - "#!/bin/bash -xe"
- sudo yum update -y
- sudo yum install httpd24 php56 php56-mysqlnd -y
- sudo yum install mysql -y
- sudo service httpd start
- echo "<html><body><h1>Testing page !!!</h1>" >> /var/www/html/index.html
- echo "</body></html>" >> /var/www/html/index.html






amazon-cloudformation snapshot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 5 at 6:34









piet.t

9,90363245




9,90363245










asked Oct 5 at 5:20









Jing Zhang

63




63












  • You cannot attached an EBS volume to two instances. Rather look at using EFS.
    – George Rushby
    Oct 10 at 13:14












  • I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
    – Jing Zhang
    Oct 13 at 21:22


















  • You cannot attached an EBS volume to two instances. Rather look at using EFS.
    – George Rushby
    Oct 10 at 13:14












  • I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
    – Jing Zhang
    Oct 13 at 21:22
















You cannot attached an EBS volume to two instances. Rather look at using EFS.
– George Rushby
Oct 10 at 13:14






You cannot attached an EBS volume to two instances. Rather look at using EFS.
– George Rushby
Oct 10 at 13:14














I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
– Jing Zhang
Oct 13 at 21:22




I also tried to use efs but failed to mount efs in LaunchConfig. link Do you have any idea? Many thanks.
– Jing Zhang
Oct 13 at 21:22












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try to use EFS as an intermediate storage and mount it to each instance. Furthermore, you can use S3 bucket for such data. S3 is also may be mounted to instances as a file system.




  • In order to mount EFS you need to install amazon-efs-utils

  • In order to mount S3 bucket to your instances, you need you to install do
    next:


sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel



git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse
./autogen.sh
./configure --prefix=/usr --with-openssl
make
sudo make install



After you installed needed tools try to mount the bucket



s3fs your_bucketname /mys3bucket -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com


Add this process to your user data and it will be done each time after new instance is starting or create custom AMI






share|improve this answer





















    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',
    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%2f52658785%2faws-snapshot-for-backup-using-cloudfromation%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Try to use EFS as an intermediate storage and mount it to each instance. Furthermore, you can use S3 bucket for such data. S3 is also may be mounted to instances as a file system.




    • In order to mount EFS you need to install amazon-efs-utils

    • In order to mount S3 bucket to your instances, you need you to install do
      next:


    sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel



    git clone https://github.com/s3fs-fuse/s3fs-fuse.git
    cd s3fs-fuse
    ./autogen.sh
    ./configure --prefix=/usr --with-openssl
    make
    sudo make install



    After you installed needed tools try to mount the bucket



    s3fs your_bucketname /mys3bucket -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com


    Add this process to your user data and it will be done each time after new instance is starting or create custom AMI






    share|improve this answer

























      up vote
      0
      down vote













      Try to use EFS as an intermediate storage and mount it to each instance. Furthermore, you can use S3 bucket for such data. S3 is also may be mounted to instances as a file system.




      • In order to mount EFS you need to install amazon-efs-utils

      • In order to mount S3 bucket to your instances, you need you to install do
        next:


      sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel



      git clone https://github.com/s3fs-fuse/s3fs-fuse.git
      cd s3fs-fuse
      ./autogen.sh
      ./configure --prefix=/usr --with-openssl
      make
      sudo make install



      After you installed needed tools try to mount the bucket



      s3fs your_bucketname /mys3bucket -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com


      Add this process to your user data and it will be done each time after new instance is starting or create custom AMI






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Try to use EFS as an intermediate storage and mount it to each instance. Furthermore, you can use S3 bucket for such data. S3 is also may be mounted to instances as a file system.




        • In order to mount EFS you need to install amazon-efs-utils

        • In order to mount S3 bucket to your instances, you need you to install do
          next:


        sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel



        git clone https://github.com/s3fs-fuse/s3fs-fuse.git
        cd s3fs-fuse
        ./autogen.sh
        ./configure --prefix=/usr --with-openssl
        make
        sudo make install



        After you installed needed tools try to mount the bucket



        s3fs your_bucketname /mys3bucket -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com


        Add this process to your user data and it will be done each time after new instance is starting or create custom AMI






        share|improve this answer












        Try to use EFS as an intermediate storage and mount it to each instance. Furthermore, you can use S3 bucket for such data. S3 is also may be mounted to instances as a file system.




        • In order to mount EFS you need to install amazon-efs-utils

        • In order to mount S3 bucket to your instances, you need you to install do
          next:


        sudo yum install automake fuse fuse-devel gcc-c++ git libcurl-devel libxml2-devel make openssl-devel



        git clone https://github.com/s3fs-fuse/s3fs-fuse.git
        cd s3fs-fuse
        ./autogen.sh
        ./configure --prefix=/usr --with-openssl
        make
        sudo make install



        After you installed needed tools try to mount the bucket



        s3fs your_bucketname /mys3bucket -o use_cache=/tmp -o allow_other -o uid=1001 -o mp_umask=002 -o multireq_max=5 -o use_path_request_style -o url=https://s3-{{aws_region}}.amazonaws.com


        Add this process to your user data and it will be done each time after new instance is starting or create custom AMI







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 12:17









        Roman Banakh

        294




        294






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f52658785%2faws-snapshot-for-backup-using-cloudfromation%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

            Feedback on college project

            Futebolista

            Albești (Vaslui)